Computer Science, asked by shre393915, 11 months ago

Q1. Write a program to input product code (pc) in character, quantity of the
product purchased and rate of one piece of the product. Calculate the total
purchase amount and print it along with the gift to be presented on the
following basis:
Amount of purchase
Gifts
200 and above but less than 700 A key chain
700 and above but less than 1200 A carry bag
1200 and above
A calculator​

Attachments:

Answers

Answered by sarthaksingh62
13

hi this is your answer in java language

Attachments:
Answered by ParvezShere
5

Using C++ language -

#include<iostream>

#include<string.h>

using namespace std;

int main()

{

int total , n, price ;

string code;

cout<<"Enter the product code of the item purchased "<<endl;

cin>>code;

cout<<"Enter the price of one piece of the product purchased "<<endl;

cin>>price;

cout<<"Enter the quantity of the product purchased "<<endl;

cin>>n;

total = price * n;

cout<< " The total amount = " <<total;

if(total>=200 & total < 700)

{

cout << " Congrats you have won a key chain ";

}

if(total>=700 & total < 1200)

{

cout << " Congrats you have won a carry bag ";

}

if(total>=1200)

{

cout << "Congrats you have won a calculator";

}

else

{

cout<<"You have won nothing ";

}

}

Similar questions