76 956
Assignments Done
98,7%
Successfully Done
In June 2019

Answer to Question #2517 in Java | JSP | JSF for zaara

Question #2517
1. Sphere
Design and implement a class called Sphere that contains instance data that represents the sphere's diameter. Define the Sphere constructor to accept and initialize the diameter, and include getter and setter methods for the diameter. Include methods that calculate and return the volume and surface area of the sphere (Volume= 3/4 π r3 , area = 4 π r2 ). Include a toString method that returns a one-line
description of the sphere. Create a driver class called MultiSphere, whose main method instantiates and updates several (at least 5) Sphere objects.

2. Shopping cart
Create 3 shopping carts from a Cart class. Each class should have four items in it, a title, a price for the 4 items and the number of each. Your shopping cart should use private variables, so use getter and setter methods to access the items (variables) in your Cart Object. After you have created three Cart objects with four items each, you should print the cart contents. Use a method called displayCart() to make it easier to print out the items for each shopping cart. A sample output for the first cart is given below and you may choose your preferred way to show the output of the 3 carts.
************Cart 1*************
---------- Your Shopping Cart ----------
1. Paper 4.99 3
2. Pencils 1.49 2
3. Pens 2.39 2
4. Printer Ink 39.99 4
-----------------------------------------------
Total:
182.69


3.Flights
Design and implement a class called Flight that represents an airline flight. It should contain instance data that represents the airline name, flight number, and the flight's origin and destination cities. Define the Flight constructor to accept and initialize all instance data. Include getter and setter methods for all instance data. Include a toString method that returns a one-line description of the flight. Create a driver class called FlightTest, whose main method instantiates and updates several (at least 5) Flight objects.

4- Leap Year
Design and implement an application that reads an integer value representing a year from the user. The purpose of the program is to determine if the year is a leap year(and therefore has 29 days in February) in the Gregorian calendar. A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is not a leap year because it is divisible by 100, but the year 2000 is a leap year because even though it is divisible by 100, it is also divisible by 400. Produce and error message for any input value less than 1582 (the year the Gregorian calendar was adopted).
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions