In this assignment, you will practice designing a more complex class, using while loops, using conditionals, using
Question:
In this assignment, you will practice designing a more complex class, using while loops, using conditionals, using a Scanner object and mathematical expressions.
-----------------------------------------------------------
For this assignment, you will write a class for the game Pig. Your file should be called DinnerOutLASTNAME.java where LASTNAME is replaced with your last name (notin all capital letters). Be sure to name your class and constructor according to this file name.
The class will contain the following attributes:
- n (number of people in the dinner party)
- person1, person2, person3, person4, person5, person6
- tax
- tip
- amount1, amount2, amount3, amount4, amount5, amount6
- scan (a Scanner object)
The "person" variables should point to the names of the people in the dinner party and the amounts should correspond to their totals.
The code should do the following:
- Ask the user how many people are in the party (if they enter more than 6, let them know 6 is the maximum and set n = 6)
- Ask the user to provide names for each person
- Ask the user to enter the cost of each item in the bill corresponding to the person. It should allow them to enter as many items as they like. If the user wishes to stop, they can indicate this by entering 0.
- Ask the user for the tax
- Ask the user for the tip
- Display the totals each person owes.
You are allowed to organize your code however you like. The code should have a constructor and as toString() method. The toString method should print out the amounts owed by each member of the dinner party. Attached is a printup of one way this could work.