6. Create a class named Purchase. Each Purchase contains an invoice number, amount of sale and amount of sales tax. Add
Posted: Mon Mar 21, 2022 4:44 pm
6. Create a class named Purchase. Each Purchase contains an invoice number, amount of sale and amount of sales tax. Add a no-argument constructor which initializes invoice number to 0, sale amount and sales tax to 0.0 and a constructor that initializes all instance variables through the parameters. Include a set method for the invoice number and two overloaded setSale Amount() methods: • void setsaleAmount (double amount) // set of sale only void setsaleAmout (double amount, double rate) //set sale amount and calculate sales tax based on the second argument Also include a display0 method that displays a purchase's details. amount Create an application that declares a Purchase object and prompts the user for purchase details. Set all the purchase details to the Purchase object. Finally, display the objects invoice number, sale amount and sales tax.