Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) [5 pts] Build a simple calculator using switch statements which can perform the four operations +, -, *,/. Write a program that asks the

image text in transcribed
1) [5 pts] Build a simple calculator using switch statements which can perform the four operations +, -, *,/. Write a program that asks the user to enter two numbers/operands. Then prompt the user to enter the operator +,, ). Perform the corresponding operation and display the answer to user. The format Example of multiplication Microsoft Visual Studio Debug Console an operator (+, -, *, ): Enter two operands: 25.5 2.314 25.5 2.314597 2) [5 pts] Create a program to prompt the user to enter the number of candy bars he or she would like to buy. The input will be a number. Use the switch/case structure to determine the bill, where 1 bar $0.75 2bars- $1.25 3 bars $1.65 more than 3 bars 1.65$0.30 (number ordered -3) Hint: Use iflelse statement to check if the user enters a positive number for number of bars Otherwise display an error message. Microsoft Visual Studio Debug Console nter number of bars: 5 of 5 bars is $2.25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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