Answer to Question #181459 in C++ for Skye Jordan

Question #181459

Create program using appropriate control structure. 


  1. Jusco Supermarket is now offering some discount on selected items for Carnival Mega sale. Write program to help the supermarket cashiers to calculate the net price of the selected product’s below.

Position Discount

1. Food Item 5 %

2. Health Item 6%

3. Electric Item 9%

4. Cloth Item 4 %


2. Write a program that prompts the user to input two number and symbol ( + , - , * , /). The program should then output the number and message saying result of the operation.



1
Expert's answer
2021-04-14T12:38:53-0400
#include <iostream>
using namespace std;
int main()
{
    int count1, count2, count3, count4;
    double price1, price2, price3, price4, total;
    cout<<"Enter count food and price food: ";
    cin >> count1>>price1;
    cout<<"Enter count health and price health: ";
    cin >> count2>>price2;
    cout<<"Enter count electric and price electric: ";
    cin >> count3>>price3;
    cout<<"Enter count cloth and price cloth: ";
    cin >> count4>>price4;
    
    total=count1*price1*(100-5)/100+count2*price2*(100-6)/100+count3*price3*(100-9)/100+count4*price4*(100-4)/100;
    cout << "total: " << total;
    return 0;
}
#include <iostream>


using namespace std;


int main()
{
    double num1, num2, result;
    char t;
    cout<<"Enter two numbers and operator(*/+-)";
    cin>> num1>> num2>>t;
    if (t=='*')
        result=num1*num2;
    if (t=='/')
        result=num1/num2;
    if (t=='-')
        result=num1-num2;
    if (t=='+')
        result=num1+num2;
    cout << "result = " << result;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS