Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Statement Write a program to compute a bill. It prompts the user three times to enter an item name and a price. The price

Problem Statement
Write a program to compute a bill. It prompts the user three times to enter an item name and a price. The price must be stored as floating point value. It then computes the total and outputs it to the console.
WARNING: Be sure to add a space before and after each operator, e.g. write cout << value; instead of cout<
#include
using namespace std;
int main()
{
// declare variables for three item names
string item1;
// declare variable named item2
// declare variable named item3
// declare variables for three item prices
float price1;
// declare variable named price2
// declare variable named price3
cout << "Item 1: ";
cout << "Price 1: ";
cout << "Item 2: ";
cout << "Price 2: ";
cout << "Item 3: ";
cout << "Price 3: ";
float total =
; // compute sum in order of prices 1,2, and 3
cout << "Total: "<<
;
// return statement
}

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

Recommended Textbook for

Postgresql 16 Administration Cookbook Solve Real World Database Administration Challenges With 180+ Practical Recipes And Best Practices

Authors: Gianni Ciolli ,Boriss Mejias ,Jimmy Angelakos ,Vibhor Kumar ,Simon Riggs

1st Edition

1835460585, 978-1835460580

More Books

Students also viewed these Databases questions