Question
Your friend Chuck owns several pizza stands distributed throughout the town. You are the java expert who will help Chuck keep track of the number
Your friend Chuck owns several pizza stands distributed throughout the town. You are the java expert who will help Chuck keep track of the number of pizzas sold by the stand as well as the total number of pizzas sold in all the stands. For this, define a class named PizzaStand that has an instance variable for the Pizza Stands ID number and an instance variable for how many pizzas sold in that stand that day. Add a static variable that tracks the total number of pizzas sold by all the stands. Add another static variable that specifies the cost per pizza.
*I am using JGrasp so please make sure it is compatible *FULL QUESTION IN IMAGES BELOW
Exercise 2: Your friend Chuck owns several pizza stands distributed throughout the town. You are the java expert who will help Chuck keep track of the number of pizzas sold by the stand as well as the total number of pizzas sold in all the stands. For this, define a class named PizzaStand that has an instance variable for the Pizza Stand's ID number and an instance variable for how many pizzas sold in that stand that day. Add a static variable that tracks the total number of pizzas sold by all the stands. Add another static variable that specifies the cost per pizza. Add the following methods: A constructor that sets the ID number to some value and the number of pizzas sold by that stand to 0 A method named justSold that increments the number of pizzas sold by that stand by 1 Another method to return the number of pizzas sold by that stand. A static method to set the cost per pizza. A static method that returns the total number of pizzas sold by all stands A static method to return the total sales. Test the class for at least three different input sets (each with at least five pizza stands) that each sell a number of pizzas during the day. A sample screen dialog is given below. The cost of the pizza is set to $5.00. Pizza Sales 1 2 (means that Pizza Stand 1 sold 2 pizzas) 1 1 1 Total pizzas sold 6 Total sales: $30.00 Process completed What to submit: Pizza.java, PizzaDemo.java and the outputs generated by your code for the input sets in a text file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started