Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

In Java, please help with the code Homework1 consists of two parts. Both parts should be contained as separate static methods in a class called

In Java, please help with the code

Homework1 consists of two parts.

Both parts should be contained as separate static methods in a class called Homework1 and called from the main() method in that class.

The first method, calculateShippingDate(), should consecutively display three dialog boxes, asking the user to input the day, month and year of the desired delivery date.

Using a constant for the shipping time (in days) that has the value 10, it should then calculate the required shipping date (in this example 10 days earlier) and output this shipping date.

The second method, calculatePizzas(), should ask they user to enter values for the diameter of a smaller pizza, the name of the smaller pizza, the diameter of the bigger pizza and the name of the bigger pizza on the console.

It should then output the names, diameters and areas of both pizzas, as well as how much larger (in area) the bigger pizza is than the smaller one.

image text in transcribedFor the second method you are required to create a class Pizza with private fields for diameter and name, as well as non-static methods that calculate the area of the pizza and return a description of the pizza. The method calculatePizzas() must create two Pizza instances and use their methods to create the required output.

Sample Run of Program The followings show a sample run of the program: Input Desired year of delivery: \begin{tabular}{|l|} \hline Message \\ The requested dellvery date is: 2023-03-05 \\ The resulting shippig date is: 2023-02-23 \\ \hline \end{tabular} Please enter the diameter of the smaller pizza in cm: 25 Please enter the name of the smaller pizza: Salami Please enter the diameter of the bigger pizza in cm: 38 Please enter the name of the bigger pizza: Veggie Delight Small pizza: The pizza Salami has a diameter of 25.0cm and an area of 490.8738521234052cm2 Big pizza: The pizza Veggie Delight has a diameter of 30.0cm and an area of 766.8583476577034cm2 The bigger pizza is 1.44 time bigger than the smaller pizza

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions