Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let s say we had a shop, MyShoppe, and wanted to prompt for the shop name. We would use: This will store the user entered

Lets say we had a shop, MyShoppe, and wanted to prompt for the shop name. We would use: This will store the userentered shop name into the variable shopName. Lets prompt for the quantity of 2 items in the shop, a ring and glasses. Run the program as it is; it prompts for user input, but doesnt output anything. Lets add print statements for our current variables Test the program. We can see that the program works and prints the correct quantities that we entered. Lets say we wanted to add up all of our inventory in our shop and print the total. Try: What do you think the inventory total will be if we have 4 rings and 5 glasses? Test it (run the program).
Notice how the output is 45 and not 9. Why is that? Well, when you take a value from input it is a string value by default. So when we ask for the shop name, it is a string value. When we ask for the QTY, it is also a string value by default. What is happening when we add these 2 quantity string values is they are being concatenated. This means we

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

Students also viewed these Databases questions

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

4. What will the team agreement contain?

Answered: 1 week ago