Lab 4: Shopping lists One of the components of BUS 101 is to practice learning material on your own. As you’ll see throu

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Lab 4: Shopping lists One of the components of BUS 101 is to practice learning material on your own. As you’ll see throu

Post by answerhappygod »

Lab 4: Shopping lists
One of the components of BUS 101 is to practice learning material on your own. As you’ll see throughout the quarter, it’s not possible to learn everything about IS in 10 weeks. I want you to get in the habit of using your allowed resources and practicing learning on your own. You’ll have to learn new material on your own when you get into industry.
How to find the length of a string
How to print a quotation mark (read the ##Quotes and Apostrophes section near the top)
Scotty Highlander and his friend Peter Anteater are roommates. This week, it’s Scotty’s turn to do the grocery shopping for both of them. He needs your help in making two shopping lists—one for him and one for Peter. For some weird reason, Peter always wants the same things that Scotty wants, and then a few extra items. Scotty needs a list of things to buy for himself and another list of things to buy for Peter.
Create a new repl for this lab. Do not reuse a repl from a previous lab or class activity.
Let Scotty (i.e., the user) enter something to buy, one by one, until he types in ‘x’ (without quotes).
Store each item in a list called scotty.
Without quitting your program, Peter (i.e., the same user) will enter items that he wants to buy.
Peter’s list should be called peter. It should contain everything from Scotty’s list, plus the extra items that Peter wants.
When Peter is done with his list, he should be able to type ‘x’ (without quotes) to tell your program that he is done adding things.
Print each item in Scotty’s list, one by one, each one on a new line. You will not earn full credit if you just print the scotty variable.
Print each item in Peter’s list, one by one, each one on a new line. You will not earn full credit if you just print the peter variable.
Find the longest item name in Scotty’s list and tell him what it is.
Find the shortest item name in Peter’s list and tell him what it is.
Your TA will not type ‘x’ as the first item.
No items will have the same length.
Each output below is from one run of the program. I copied my text from the black area.
Hi Scotty, what do you need at the store?
Enter item or x to quit: aaa
Enter item or x to quit: bbbb
Enter item or x to quit: ccccc
Enter item or x to quit: x
Thanks Scotty. Your turn, Peter!
Enter item or x to quit: dd
Enter item or x to quit: eeeeeeeeee
Enter item or x to quit: x
Scotty's list:
aaa
bbbb
ccccc
Peter's list:
aaa
bbbb
ccccc
dd
eeeeeeeeee
Scotty's longest item is: ccccc
Peter's shortest item is: dd
Hi Scotty, what do you need at the store?
Enter item or x to quit: macaroni
Enter item or x to quit: egg
Enter item or x to quit: cheese
Enter item or x to quit: x
Thanks Scotty. Your turn, Peter!
Enter item or x to quit: sauce
Enter item or x to quit: x
Scotty's list:
macaroni
egg
cheese
Peter's list:
macaroni
egg
cheese
sauce
Scotty's longest item is: macaroni
Peter's shortest item is: egg
Prof. Rich note: it doesn’t matter that ‘egg’ was entered by Scotty because Peter’s list starts with the same items that Scotty has. Peter then adds extra items to his list only.
When you are done with your code, click into your browser’s address bar and copy that entire link.
Submit this link in your discussion eLearn.
100 points total.
Listed below are the test cases your TA will use with your program. Each test case is denoted by a letter. For the given input, your program’s output should match the output below. Test case letters with a number after it denote an error and how much each error is worth.
Important note: do not specifically look for the values below. Your TA should be able to enter any valid input and your program should work organically.
H -20: deduction if your TA notices any hard coding
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply