+1-415-670-9189
info@expertsmind.com
Application that calculates and displays the total payable
Course:- JAVA Programming
Reference No.:- EM13897476




Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> JAVA Programming

Assessment task

Write a java application that calculates and displays the total payable after applying discount on online grocery orders for N customers. The N should be set as a constant (final) in your application and choose a value between 7 and 9. The discount rates are as shown below in Table 1.

Table 1: Discount Details

Purchase Amount

Applicable Discount Rate %

Below $75

0%

>= $75 and < $100

5%

>= $100 and < $150

7%

>= $150 and < $200

9%

>= $200

11%

The program should ask the user to enter the first name of the customer and the total purchase amount in dollars. The purchase amount should be between 10 and 400. Validate the user input, display error message and allow the user to correct the error by reading two more entries for the purchase amount.

Based on the purchase amount, the program should apply the applicable discount and calculate the total payable amount. The application should display a message with first name, and total payable. At the end of the Nth customer the program should display a summary of purchases displaying the largest purchase amount, smallest purchase amount, total payable for all customers, and total discount amount applied. The format of your input and output must be same as given in example below.

Enter the name for Customer 1: John
Enter the purchase amount for Customer 1: 68 Hi John, the total payable is $68.0

Enter the name for Customer 2: Sally
Enter the purchase amount for Customer 2: 95 Hi Sally, the total payable is $90.25

Enter the name for Customer 3: James
Enter the purchase amount for Customer 3: 140 Hi James, the total payable is $130.20

The application should be user-friendly by displaying appropriate welcome and exit messages. The following classes and methods could be used.

public class Customer
{
//declare constants
//declare fields/attributes to store the name and purchase amount
// constructor
// Accessor, mutator methods (get and set )
// Method to calculate total payable applying discount.
}

public class CustomerTest
{
//declare constants required
public static void main(String[] args)
{
//create object
//Loop through taking user input for name and purchase amount and use set methods
//calculate total payable using the defined method
// compute other required values
//print output as shown in the example
}
}

Note: Once you complete coding and testing, go through the marking criteria to ensure that your application meets all the requirements. Avoid any sort of plagiarism.




Put your comment
 
Minimize


Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the follow
This list has some values that occur just once (1, 3, 4, 11, 13, 18), some values that occur twice (9, 16), some values that occur three times (14, 19) and a single value th
Write a Java Sorting Application with two classes, JavaSort and JavaSortTest. Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, She
Fish has an attribute which stores whether the fish is an herbivore or a carnivore. Its eats method checks whether herbivore or carnivore, and prints 'This fish eats veggies
Write a script that reads a four-digit integer entered by the user in a prompt dialog and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulu
Write a Java program that prints all real solutions to the quadratic equation ax^2 + bx + c = 0. Read in a, b, c and use the quadratic formula. If the discriminant (b^2 - 4a
Implement a client program with a main method to demonstrate the evolution of the sales tax rates in the 50 US states over the last 10 years. Declare a two-dimensional array
A method with the signature public static void printDetails(City[] cities) that will iterate through the cities and printthe details of the city using the displayDetails(...