Write structures for each of the following Do not write a co

Write structures for each of the following. Do not write a complete program

1) if AVERAGE if less than 60 1) display \"FAIL\" and increment FAIL by 1 otherwise display \"PASS\" and increment PASS by 1

2) if AGE is less than 20 Discount is 10% of TICKET_COST, if AGE is 20 or more but less than 40 DISCOUNT is 30% of TICKET_COST otherwise DISCOUNT is 40%.

3) Ask user for an integer from 1 to 100 and display \"OUT OF RANGE\" if the number entered is not within range. If the number is withing range check if the number is odd or even and display ODD or EVEN respectively.

4) Ask for AGE and check if the person is a teenager ( AGE greater than or equal 13 but less than 20).

5) Ask user for MAT_SCORE and READING_SCORE (integers). Display the following depending on the scores -

a) if MAT_SCORE and READING_SCORE exceeds 500 Display \"ACCEPTED\"

b) if one score exceeds 500 and other does not display \" ON WAITING LIST\"

c) if both scores if 500 or less display \"NOT ACCEPTED \"

6) Ask the user for two integers and display a) First is great than second b) First is less than second or c) First and second are the same depending on the condition.

7) A store if giving discounts on the cost of a coat. If the coat has a

LIST_PRICE Discount

up to $200 10%

More than 200 but less than $300 25%

$300 or more 35%

If the SALEST_TAX_RATE is 8.5% compute and display

1) The discount amount

2) The SALES_TAX_AMOUNT

3) The final cost of the coat.

Solution

1) if AVERAGE if less than 60 1) display \"FAIL\" and increment FAIL by 1 otherwise display \"PASS\" and increment PASS by 1

Answer

int average,pass=0,fail=0;
cout<<\"\ Enter average : \";
cin>>average;
if(average<60)
{
cout<<\"\ FAIL\";
fail++;
}
else
{
cout<<\"\ PASS\";
pass++;
}   
cout<<\"\ FAIL :\"<<fail;
cout<<\"\ PASS :\"<<pass;

2) if AGE is less than 20 Discount is 10% of TICKET_COST, if AGE is 20 or more but less than 40 DISCOUNT is 30% of TICKET_COST otherwise DISCOUNT is 40%.

Answer

int discount,age;
double TICKET_COST,Final_cost;
cout<<\"\ Enter TICKET_COST : \";
cin>>TICKET_COST;
cout<<\"\ Enter AGE : \";
cin>>age;
if(age<20)
discount=10;
else if(age>=20&&age<40)
discount=30;
else
discount=40;
Final_cost=TICKET_COST-TICKET_COST*discount/100;
cout<<\"\ TICKET_COST : \"<<TICKET_COST;
cout<<\"\ AGE : \"<<age<<\" Years\";
cout<<\"\ Discount : \"<<discount<<\"%\";
cout<<\"\ Final Price : \"<<Final_cost;

3) Ask user for an integer from 1 to 100 and display \"OUT OF RANGE\" if the number entered is not within range. If the number is withing range check if the number is odd or even and display ODD or EVEN respectively.

Answer

int number;
cout<<\"Enter number : \";
cin>>number;
if(number>=1&&number<=100)
{
if(number%2==0)
cout<<\"\ EVEN Number\";
else
cout<<\"\ ODD Number\";
}
else
cout<<\"\ Number out of Range\";

4) Ask for AGE and check if the person is a teenager ( AGE greater than or equal 13 but less than 20).

Answer

int age;
cout<<\"Enter your Age : \";
cin>>age;
if(age>=13&&age<20)
    cout<<\"\ You are a Teenager\";
else
cout<<\"\ You are NOT a Teenager\";

5) Ask user for MAT_SCORE and READING_SCORE (integers). Display the following depending on the scores -

a) if MAT_SCORE and READING_SCORE exceeds 500 Display \"ACCEPTED\"

b) if one score exceeds 500 and other does not display \" ON WAITING LIST\"

c) if both scores if 500 or less display \"NOT ACCEPTED \"

Answer

int MAT_SCORE,READING_SCORE;
cout<<\"Enter MAT_SCORE: \";
cin>>MAT_SCORE;
cout<<\"Enter READING_SCORE: \";
cin>>READING_SCORE;
if(READING_SCORE>500&&MAT_SCORE>500)
cout<<\"\ ACCEPTED\";
else if(READING_SCORE>500||MAT_SCORE>500)
cout<<\"\ ON WAITING LIST\";
else if(READING_SCORE<=500&&MAT_SCORE<=500)
cout<<\"\ NOT ACCEPTED\";

6) Ask the user for two integers and display a) First is great than second b) First is less than second or c) First and second are the same depending on the condition.

Answer

int num1,num2;
cout<<\"Enter num1: \";
cin>>num1;
cout<<\"Enter num2: \";
cin>>num2;
if(num1>num2)
cout<<\"\ First is great than second\";
else if(num1<num2)
cout<<\"\ First is less than second\";
else
cout<<\"\ First and second are the same\";

7) A store if giving discounts on the cost of a coat. If the coat has a

LIST_PRICE Discount

up to $200 10%

More than 200 but less than $300 25%

$300 or more 35%

If the SALEST_TAX_RATE is 8.5% compute and display

1) The discount amount

2) The SALES_TAX_AMOUNT

3) The final cost of the coat.

Answer

int discount;
double LIST_PRICE,Final_cost,SALEST_TAX_RATE=8.5,discount_amount,SALES_TAX_AMOUNT;
cout<<\"\ Enter LIST_PRICE of Coat : \";
cin>>LIST_PRICE;
if(LIST_PRICE<=200)
discount=10;
else if(LIST_PRICE>200&&LIST_PRICE<300)
discount=25;
else
discount=35;
discount_amount=LIST_PRICE*discount/100;
SALES_TAX_AMOUNT=(LIST_PRICE-discount_amount)*(SALEST_TAX_RATE/100);
Final_cost=(LIST_PRICE-discount_amount)+SALES_TAX_AMOUNT;
cout<<\"\ List Cost : \"<<LIST_PRICE;
cout<<\"\ Discount Amount : \"<<discount_amount;
cout<<\"\ SALES_TAX_AMOUNT : \"<<SALES_TAX_AMOUNT;
cout<<\"\ Final Price : \"<<Final_cost;

Write structures for each of the following. Do not write a complete program 1) if AVERAGE if less than 60 1) display \
Write structures for each of the following. Do not write a complete program 1) if AVERAGE if less than 60 1) display \
Write structures for each of the following. Do not write a complete program 1) if AVERAGE if less than 60 1) display \
Write structures for each of the following. Do not write a complete program 1) if AVERAGE if less than 60 1) display \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site