Question: FAST AS POSSIBLE !! ty Use your first name instead of Fn js1234 bought a medium sized pizza with six slices from NSU Pizzeria for

FAST AS POSSIBLE !! ty

Use your first name instead of Fn

"js1234 bought a medium sized pizza with six slices from NSU Pizzeria for a base price of $9.99 and 2 additional toppings at an extra cost. "

Substitute js1234 with your Nova Student email id i( just the email id and not the domain name) in the above statement.

Based on the above statement.

Create a generic class called Pizzeria.

Identify the private attributes of the class based on the above statement,

have a no arg constructor and

a regular constructor which takes in arguments

Have a toString() function when called generates the statement exactly like the one given above.

Write a method for the class calcPriceFn( double prPerTop ) which takes an argument Price per topping and multiply it by the number of toppings and added to the base price of the Pizza to calculate the total price. For example if the base price is 10$ and number of toppings is 3 and price per topping which is passed into the function is $2.00, the total price of the Pizza is $16.00 ( BasePrice + Price per topping * Number of toppings which is 10 + 2 * 3 = 16)

Just one get and set for one attribute required.

Write a main to create an object of the class P1 using the regular constructor. The variables passed into the constructor should make sure that System.out.println( P1 ) should print out the above statement where js1234 is replaced with your student email id.

In the main ask the user to enter the price per topping as input and calculate the price for the object P1 using the calcPriceFn function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!