Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please type it out in java like it is given will like Program Specifications Write a SelfPayKiosk class to support basic operations such as scan

please type it out in java like it is given will like image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Program Specifications Write a SelfPayKiosk class to support basic operations such as scan item, cancel transaction, checkout, and make Jayment. SelfPaykiosk java is provided with method stubs. Follow each step to gradually complete all methods Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. The main0 method in LabProgramjava includes basic method calls. Add statements in main0 as methods are completed to support development mode testing Step 0. Declare private fields for number of customers served (int), total sales (double), and current amount due (double), Note the provided final variable for sales tax of 7% Step 1 (1 pts). 1) Complete the constructor to initialize all private fields to zero. 2) Complete the accessor methods to return the number of customers served, total sales, and current amount due. Submit for grading to confirm 1 test passes. Step 2 ( 2 pt). Complete the scanitem0 method. Increase the amount due by parameter price. Do not update amount due if parameter price is negative. Submit for grading to confirm 3 tests pass Step 3 (1 pt). Complete the checkOut) method. Multiply amount due by SALES.TAX and add to amount due. Submit for grading to confirm 4 tests pass. Step 4 (2 pts). Complete the makePayment() method. If parameter payment is enough to pay the amount due, increase total sales by amount due, increment number of customers served, and reset amount due to zero in preparation for the next customer. However, if parameter payment is not enough, update total sales by payment and reduce amount due by payment. Do not make any changes if parameter payment is negative: Subinit for grading to confirm 6 tests pass: Step 5 (1 pt). 1) Complete the resetkiosk0 method to reset all private fields to zero. 2) Complete the cancelTransaction0 method to reset amount due to zero. Submit for grading to confirm 7 tests pass: Step 6 (2 pts). Complete the simulateSales 0 method to perform multple transactions with increasing prices. Use a loop to simulate parameter numSales transactions. Within the loog, call scantiem0 with parameter initil Price. Call checkout0 and makePayment0 to make a payment of $1 more than the amount due. Finally, increase the item price by parameter incrPrice in preparation for the next transaction. Submit for grading to confirm 8 tests pass. Step 7 (1 pt). Add a boolean private fied to indicate if the customer has checked out and is ready to make a payment Only allow payment after customer has checked out. The canceffransaction0 method should not reset amount due if the customer has checked out. Update the following methods by inserting assigntrent statements and if statements related to the boolean filed constructor, checkout0. makePayment0, and cancelTrantaction0. Ex Set the boolean field to false only after full poyment has been made. Submit for arading to confirm all tests pass Current file: LabProgram.java Load default template // Test simulateSales() kiosk.resetKiosk(); kiosk.simulateSales (100,5,2.5); System.out.println("Number of customers: " + kiosk.getNumCustomers()); System.out.printf("Amount due: %.2f , kiosk. getAmountDue()); System.out.printf("Total Sales: \%.2f(n", kiosk.getTotalSales()); 3 Current file: SelfPayKiosk.java - II Return current amount due public double getAmountDue() \{ / * Update the return statment */ return 1.0 \} II Return number of customers served public int getNum(ustomers() \{ / Update the return statment */ return 1; 3 II Scan one item public void scanItem(double price) \{ / Complete the method */ Current file: SelfPayKiosk.java - Il Apply sales tax to current purchases public void checkOut() \{ /* Complete the method */ \} II Cancel current purchases public void cancelTransaction() \{ / Complete the method */ \} II Reset register for the day public void resetKiosk() \{ /* Completelthe method */ Current file: SelfPayKiosk.java - Load d // Reset register for the day public void resetKiosk() \{ / Complete the method */ \} I/ Apply payment to amount due public void makePayment (double payment) \{ I. Complete the method */ \} I/ Simulate multiple transactions public void simulateSales(int numsales, double initialPrice, double incrPrice) \{ / Complete the method "/ \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Describe the building block concepts of costing systems

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago