Find Jobs
Hire Freelancers

JAVA codes

$30-100 USD

In Progress
Posted over 12 years ago

$30-100 USD

Paid on delivery
Question 1 (Using the GregorianCalendar class) Java API has the GregorianCalendar in class in [login to view URL] package that can be used to obtain the year, month, and day of a date. The no-arg constructor constructs an instance for the current date, and the method get([login to view URL]), get(GregorianCalendar. MONTH), and get(GegorianCalendar.DAY_OF_Month) return the year, month, and day. Write a program to perform these two tasks. Display the current year, month and day The GregorianCalander class has the SetTimeInMillis(long), which can be used to set a specified elapsed time since January 1, 1970. Set the value to 1234567898765L and display the year, month and day. Question 2 (The MyPoint class) Design a class called MyPoint to represent a point with x and y-coordinates. The class contains: Two data fields x and y that represents the coordinates with get methods A no-arg constructor that creates a point(0,0) A constructor that constructs a point with specified coordinates Two get methods for data fields x and y respectively. A method named distance that returns the distance from this point to another point of the MyPoint type A method named distance that returns the distance from this point to another point with specified x- and y- coordinates Draw the UML diagram for the class. Implement the class. Write a test program that creates two points (0,0) and (10, 30.5) and displays the distance between them- question 3 (Implementing MyStack using inheritance) In Listing 11.9, MyStack is implemented using composition. Create a new stack class that extends ArrayList. Public class MyStack { Private [login to view URL] list = new java .[login to view URL](); Public Boolean isEmpty() { Return [login to view URL](); } Public int getSize() { Return [login to view URL](); } Public Object peek(){ Return [login to view URL](getSize() – 1); } Public Object pop(){ Object o = [login to view URL](getSize() – 1); [login to view URL](getSize() – 1); Return 0; } Public void push(Object o){ [login to view URL](0); } Public int search(Object o){ Return [login to view URL](o); } /**Override the toString in the Object class */ Public string toString(){ Return “stack:”+ [login to view URL](); } } Listing 11.9 Draw the UML diagram for the classes. Implement Mystack. Write a test program that prompts the user to enter five strings and displays them in reverse order
Project ID: 1152176

About the project

3 proposals
Remote project
Active 13 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi, I am JAVA Expert! I can do it in few hours. Please accept my bid. Thanks
$30 USD in 0 day
4.9 (269 reviews)
7.0
7.0
3 freelancers are bidding on average $37 USD for this job
User Avatar
Please check PMB.
$50 USD in 2 days
4.9 (34 reviews)
4.7
4.7
User Avatar
please check PM
$30 USD in 0 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Short Hills, United States
5.0
2
Member since Aug 3, 2011

Client Verification

Other jobs from this client

Java programs
$30-100 USD
Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.