Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Business P7.12 A supermarket wants to reward its best customer of each day, showing the customers name on a screen in the supermarket. For that

Business P7.12 A supermarket wants to reward its best customer of each day, showing the customers name on a screen in the supermarket. For that purpose, the store keeps an ArrayList. In the Store class, implement methods public void addSale(String customerName, double amount) public String nameOfBestCustomer() to record the sale and return the name of the customer with the largest sale.

Write a program that prompts the cashier to enter all prices and names, adds them to a Store object, and displays the best customers name. Use a price of 0 as a sentinel.

-----

-----

-----

import java.util.*;

/**

* Code for P7.12

* @author

*/

public class Store

{

public String nameOfBestCustomer(ArrayList sales,

ArrayList customers)

{

String top = " ";

// Your work starts here

// Your work ends here

return top;

}

public static void main(String[] args)

{

ArrayList price = new ArrayList();

ArrayList names = new ArrayList();

Scanner in = new Scanner(System.in);

// Your work starts here

// Your work ends here

Store top = new Store();

System.out.println("Best customer's name "

+ top.nameOfBestCustomer(price, names));

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago