Public Static Void Create New Scanner System Dateandtime Getdateandtime Shoplocation Getsh Q43860485
public static void create() {
in = new Scanner(System.in);
dateAndTime = getDateAndTime();
shopLocation = getShopLocationFromUser();
staffName = getFromUser(“your first name”);
staffName = capitalise(staffName);
//end of code
Note that in the create() method the class invokes a methodwritten to make sure that the name entered by the user iscapitalised appropriately: staffName = capitalise(staffName);. Thecapitalise(String) method takes a String parameter and returns aString. The method makes sure that the name entered by the userstarts with a capital letter, with the rest of the name in lowercase. Note that the capitalise(String) method uses String methods,such as substring() and toUpperCase() that you will find documentedin the String API.
There is a TODO comment in the create() method that reads://TODO client wants the item description in title case Differentauthorities have slightly different rules for title case, but titlecase means, in general, that every word is capitalised (meaning theword starts with a capital letter, but the rest of the word is inlower case), except for articles (a, an, the), prepositions (e.g.in, on) and conjunctions (e.g. and, or). In this case the clientwants every word capitalised except for the words: a; an; and; the;of; with. This means that if the user were to type: REPLACEBATTTERY WITH A NEW BATTERY for the item description, what would beprinted on the receipt would be: Replace Battery with a NewBattery
itemisedCosts = “”;
numberOfItemsPurchased = 0;
subtotal = 0;
boolean keepGoing = true;
//loop so that the user can enter as many items as they needto
while (keepGoing) {
//ask user to enter information about item and charges
String itemDescription = getFromUser(“Item or service user is beingcharged for”);
//TODO client wants the item description in title case
double unitPrice = getDoubleFromUser(“the unit price (without VAT)of ” + itemDescription);
int numberOfUnits = getIntFromUser(“the number of ” +itemDescription);
//TODO make above statements a method
//update receipt information with item and charges foritem
itemisedCosts += addItemisedCostToReceipt(itemDescription,unitPrice, numberOfUnits);
subtotal += (unitPrice * numberOfUnits);
numberOfItemsPurchased += numberOfUnits;
//TODO make above three statements a method
//add more items to the receipt?
String more = getFromUser(“another item or service? Yes/No”);
if (more.trim().toLowerCase().startsWith(“n”)) {
keepGoing = false;
}
//TODO make asking the user if they wish to add more items into amethod
}//end of while loop
Expert Answer
Answer to public static void create() { in = new Scanner(System.in); dateAndTime = getDateAndTime(); shopLocation = getShopLocatio…
OR