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.13

* @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_2

Step: 3

blur-text-image_3

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

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

1. Expand (a + b)6. 2. Expand (x + y)5. 3. Expand (x + h)4.

Answered: 1 week ago