Write an application that shows the sum of 1 to n for every n from 1 to 50. That is, the program displays 1 (the sum of 1 alone), 3 (the sum of 1 and 2), 6 (the sum of 1, 2, and 3), 10 (the sum of 1, 2, 3, and 4), and so on. Save the file as EverySum.java.
a. Create a class named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set() method for the sale amount, calculate the sales tax as 5% of the sale amount. Also include a display method that displays a purchase's details. Save the file as Purchase.java.
b. Create an application that declares a Purchase object and prompts the user for purchase details. When you prompt for an invoice number, do not let the user proceed until a number between 1,000 and 8,000 has been entered. When you prompt for a sale amount, do not proceed until the user has entered a nonnegative value. After a valid Purchase object has been created, display the object's invoice number, sale amount, and sales tax. Save the file as CreatePurchase.java.
Create a BabysittingJob class for Georgette's Babysitting Service. The class contains fields to hold the following:
Create a constructor for the BabysittingJob class that accepts arguments for the job number, babysitter code, number of children, and hours. The constructor determines the babysitter name and fee for the job. Also include a method that displays every BabysittingJob object field. Save the file as BabysittingJob.java.
Next, create an application that prompts the user for data for a babysitting job. Keep prompting the user for each of the following values until they are valid:
When all the data entries are valid, construct a job number from the last two digits of the year and four-digit sequential number (which might require leading zeroes). Then, construct a BabysittingJob object, and display its values. Save the file as CreateBabysittingJob.java
CreateBabysittingJob class: Enhance this program so that it asks the user if a child requires diaper changing.
BabysittingJob class: Add a Boolean variable that stores whether a child requires diaper changing. Enhance the constructor so that this value is received and the price is increased by $20 if a child requires diaper changing.