Question: Lab instructions 1. Create and implement methods for each of the following. Please don't use static while initializing the methods. a) Create a class named


Lab instructions 1. Create and implement methods for each of the following. Please don't use static while initializing the methods. a) Create a class named Restaurant in a new Java file, and Implement the following methods. i) setBalance - This will be the initial balance the restaurant has at the start. Take input from the user and initialize the balance in Class. ii) "itemPurchase" - This method will take an integer which will be the cost of raw materials and should be deducted from the balance. It will take an integer as input and returns nothing. Take input from the user. iii) "itemSell - This method will take an integer which will be sold of dishes to the customers and should be added to the restaurant balance. It will take an integer as input and returns nothing. Take input from the user. iv) getBalance - This method will return the balance left in the restaurant account. It will be takes nothing as input and returns an integer. In the end, show the balance to the user. Requirements: i. Create a separate java file named RestaurantJUnit, do at least three JUnit tests for each of your methods in main with brief comments. ii. Brief comments are required, otherwise, 5 points will be deducted. b) Create a class named Date in a new Java file, and Implement the following methods. Task1: Create a private variable of string type, named date and default as an empty string // Assume the input string for date is always in a format of MM-DD-YYYY Task2: Create methods getter named "getDate and setter named "setDate for date. Task3: Create methods getter named getMonth and setter named set Month for month. Task4: Create methods getter named getDay" and setter named setDay" for day. Task5: Create methods getter named getYear and setter named setYear for year. Task6: Create methods named getDifferent, which takes a class Date, and return the integer of total difference of days between them. (Assume that every year has 365 days, and every month has 30 days. For example, Compare Two date from two class Date 01-02-1998 and 01-03-1998, return 1, 02-01-1998 and 3-1-1998, return 30, 2-1-1998 and 2-1-2020, return 365, 2-1-2020 and 2-1-2000, return 7300. Hint: i) Getter for Task2 takes nothing and returns a string. ii) Setter for Task2 takes a string and returns nothing. (Assume the input string is always in a format of "MM-DD-YYYY", which means you don't need to use if statement) iii) Getters for Task3, Task4, and Task5 take nothing and returns an integer. iv) Setters for Task3, Task4, and Task5 take an integer and return nothing, for each setter you need to update the global variable "date. Requirements: i. Using loops and if statement is not allowed. Don't need to consider any edge cases. ii. Create a separate java file named DateJUnit, do at least three JUnit tests for each of your methods in main with brief comments. iii. Brief comments are required, otherwise, 5 points will be deducted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
