1) Using a 2 dimensional array Your company has 4 grocery stores. Each store has 3 departments where product presentation affects sales (produce, meat, frozen). Every so often any department in any store gets a bonus for doing a really good job. You need to create a program that keeps a table of bonuses in the system for all departments in all stores. In the program, you need define a two dimensional array for these bonuses. The stores can be the rows and the departments can be the columns. Have the program ask the user to enter a bonus amount, and then ask use which store (1-4) and which department (1-3) got that bonus, and then store that bonus amount to the appropriate place in the array based on the numbers they gave. The program should allow user to enter all occurred bonuses. You may use a sentinel controlled loop to do that. After this is done, add up the bonuses for each of the 4 stores [the 4 rows in your 2 dimensional array] and display them for the user. //asker user to enter bonus amount, enter 0 or less to stop while(bonus >0){ //ask user store number //ask user department number //assign the bonus to the array //ask for next bonus amount, enter 0 to stop }//end of loop 2) Exploring Array lists. Remember that array lists are good for adding and removing things and that they are clock-cycle friendlier in this case than resizing arrays as we discussed in the lecture. This lab allows you to get some hands-on using an ArrayList so you will remember it for those times it would be a good fit for an application. a) Create an Arraylist of type String and prompt the user for three names and add these names to your ArrayList. b) Print a message with the number of elements in the ArrayList for the user using the size() method (to find the number to print.)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1
1) Using a 2 dimensional array
2
Your company has 4 grocery stores. Each store has 3 departments where product presentation affects sales (produce, meat, frozen). Every so often any department
3
in any store gets a bonus for doing a really good job.
4
You need to create a program that keeps a table of bonuses in the system for all departments in all stores. In the program, you need define a two dimensional
array for these bonuses. The stores can be the rows and the departments can be the columns. Have the program ask the user to enter a bonus amount, and then ask
6
use which store (1-4) and which department (1-3) got that bonus, and then store that bonus amount to the appropriate place in the array based on the numbers
7
they gave. The program should allow user to enter all occurred bonuses. You may use a sentinel controlled loop to do that. After this is done, add up the
bonuses for each of the 4 stores [the 4 rows in your 2 dimensional array] and display them for the user.
//asker user to enter bonus amount, enter 0 or less to stop
10 while(bonus >0){
11
8
9
//ask user store number
//ask user department number
//assign the bonus to the array
//ask for next bonus amount, enter 0 to stop
12
13
14
15 }//end of loop
16
17 2) Exploring Array lists.
18 Remember that array lists are good for adding and removing things and that they are clock-cycle friendlier in this case than resizing arrays as we discussed in
19 the lecture. This lab allows you to get some hands-on using an ArrayList so you will remember it for those times it would be a good fit for an application.
a) Create an Arraylist of type String and prompt the user for three names and add these names to your ArrayList.
b) Print a message with the number of elements in the ArrayList for the user using the size() method (to find the number to print.)
c) Prompt the user for two more names and add them to the ArrayList and once again print a message with the number of elements in the ArrayList for the user.
d) Use a loop to print all of the names in the ArrayList for the user.
e. Ask the user for a name to remove, remove the value the user provides, and then use a loop to print all of the names in the ArrayList for the user.
Transcribed Image Text:1 1) Using a 2 dimensional array 2 Your company has 4 grocery stores. Each store has 3 departments where product presentation affects sales (produce, meat, frozen). Every so often any department 3 in any store gets a bonus for doing a really good job. 4 You need to create a program that keeps a table of bonuses in the system for all departments in all stores. In the program, you need define a two dimensional array for these bonuses. The stores can be the rows and the departments can be the columns. Have the program ask the user to enter a bonus amount, and then ask 6 use which store (1-4) and which department (1-3) got that bonus, and then store that bonus amount to the appropriate place in the array based on the numbers 7 they gave. The program should allow user to enter all occurred bonuses. You may use a sentinel controlled loop to do that. After this is done, add up the bonuses for each of the 4 stores [the 4 rows in your 2 dimensional array] and display them for the user. //asker user to enter bonus amount, enter 0 or less to stop 10 while(bonus >0){ 11 8 9 //ask user store number //ask user department number //assign the bonus to the array //ask for next bonus amount, enter 0 to stop 12 13 14 15 }//end of loop 16 17 2) Exploring Array lists. 18 Remember that array lists are good for adding and removing things and that they are clock-cycle friendlier in this case than resizing arrays as we discussed in 19 the lecture. This lab allows you to get some hands-on using an ArrayList so you will remember it for those times it would be a good fit for an application. a) Create an Arraylist of type String and prompt the user for three names and add these names to your ArrayList. b) Print a message with the number of elements in the ArrayList for the user using the size() method (to find the number to print.) c) Prompt the user for two more names and add them to the ArrayList and once again print a message with the number of elements in the ArrayList for the user. d) Use a loop to print all of the names in the ArrayList for the user. e. Ask the user for a name to remove, remove the value the user provides, and then use a loop to print all of the names in the ArrayList for the user.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY