140k views
5 votes
Write assembly programs with the following I/O

1. .----------------------7-11 Convenient Store ----------------------

Drinks
Soda(S)…………………………………………….…$2
Water (W)…………………………………………….$1
Sandwiches
10 inches……………………………………………..$3
12 inches……………………………………………..$5

Enter the number of customers: 2
How many drinks? 2
What kind of drink(S=Soda, W=Water)? w
How many Sandwiches? 3
What size of sandwich (10/12 inches)? 10
Your total bill = xx

How many drinks? 3
What kind of drink(S=Soda, W=Water)? S
How many Sandwiches? 3
What size of sandwich (10/12 inches)? 12
Your total bill = xx

User Pismy
by
6.2k points

1 Answer

7 votes

Answer:

Step-by-step explanation:

copy to code:

#include <iostream>

#include <string>

using namespace std;

int main()

{

//total bill amount

float totalBill=0;

//no of customers

int noOfCustomer=0;

//no of drinks

int noOfDrinks;

//drink type

char drinkType;

//no of sandwiches

int noOfSandwiches;

int sandWitchSize;

cout<<"Enter the number of customers : ";

cin>>noOfCustomer;

//loop through no of customers

for(int i=1;i<=noOfCustomer;i++){

totalBill=0;

cout<<"Enter how many drinks ? ";

cin>>noOfDrinks;

cout<<"Enter what kind of drink (S=Soda ,W=Water) ";

cin>>drinkType;

if(drinkType=='w' || drinkType=='W'){

totalBill +=noOfDrinks*1;

}else if(drinkType=='s' || drinkType=='S'){

totalBill +=noOfDrinks*2;

}

cout<<"How many Sandwiches : ";

cin>>noOfSandwiches;

cout<<"What size of sandwich (10/12 inches) ? :";

cin>>sandWitchSize;

if(sandWitchSize==10){

totalBill+= noOfSandwiches*3;

}else if(sandWitchSize==12){

totalBill+= noOfSandwiches*5;

}

cout<<"Your total bill "<<totalBill<<endl;

}

return 0;

}

Enter the number of customers : 2

How many drinks? 2

What kind of drink(S=Soda and W=Water)? w

How many sandwiches? 3

What size of sanwich(10/12inches) ? 12

Your total bill = $ 17

How many drinks? 4

What kind of drink(S=Soda and W=Water)? s

How many sandwiches? 4

What size of sanwich(10/12inches) ? 10

Your total bill = $ 20

User Jignesh Variya
by
5.2k points