LOADING...

Buy Now

Calories Counter Application Program

Instructions:

Calories Counter Application ProgramCopy your code and output of all exercises to a ONE word document and then upload the

There is a penalty for not proving a copy of correct output

Question 1:

Write a C++ program that uses if statements that given a number representing a TV channel, returns the call letters of the station corresponding to that number. Use the following channel numbers and call letters:

2: WCBS

4: WNBC

5: WNEW

7: WABC

#include <iostream>

using namespace std;

 

int main(){

intnum;

string channel;

cout<<"Enter the channel number: ";

cin>>num;

if (num==2){

cout<<"WCBS";

}

if (num==4){

cout<<"WCBC";

}

if (num==5){

cout<<"WNEW";

}

if (num==7){

cout<<"WABC";

}

}

 

 

Question 2:

Write a C++ program that uses if-else statements that given a number representing a TV channel, returns the call letters of the station corresponding to that number. Use the following channel numbers and call letters:

2: WCBS

4: WNBC

5: WNEW

7: WABC

#include <iostream>

using namespace std;

 

int main(){

intnum;

string channel;

cout<<"Enter the channel number: ";

cin>>num;

if (num==2){

cout<<"WCBS";

}

else if(num==4){

cout<<"WCBC";

}

else if (num==5){

cout<<"WNEW";

}

else if (num==7){

cout<<"WABC";

}

}

 

Question 3:

Write a C++ program that uses switch - case statement that given a number representing a TV channel, returns the call letters of the station corresponding to that number. Use the following channel numbers and call letters:

2: WCBS

4: WNBC

5: WNEW

7: WABC

#include <iostream>

using namespace std;

 

int main(){

intnum;

string channel;

cout<<"Enter the channel number: ";

cin>>num;

 

 

switch(num) {

 

case 2 :

cout<<"WCBS";

break;

 

case 4 :

cout<<"WCBC";

break;

 

case 5:

cout<<"WNEW";

break;

case 7 :

cout<<"WABC";

default :

cout<< "Invalid entry" <<endl;

}

}

Question 4:

Write a C++ program that will check if a person is eligible to vote or not. The program will ask the user to enter his/her age. If it is greater than 0, it will proceed to ask if the user's age is between and including 1 and 18. If the user's age is between and including 1 and 18, the program will display the following message"Sorry.  Please vote next year" else it will display "You can vote".

#include <iostream>

using namespace std;

 

int main(){

int age=0;

cout<<"Enter your age: ";

cin>>age;

if (age>0){

if (age>=1 || age<=18){

cout<<"Sorry, Please vote next year";

}

else {

cout<<"You can vote";

 

}

}

 

return 0;

}

Question 5:

 

Write a C++ program to check if a number is greater than or equal to zero or less than zero and if the number is odd or even.

For example, if the user enters 20, the program should say

it is even

it is greater than zero.

if the user enters -5, the program should say

it is odd

it is smaller than zero.

#include <iostream>

using namespace std;

 

int main(){

int n=0;

cout<<"Enter your n: ";

cin>>n;

 

 

if (2%n==0){

cout<<"It is even"<<endl;

}

if (2%n!=0){

cout<<"It is odd"<<endl;

}

if (n>=0){

cout<<"It is greateer than zero";

}

else{

cout<<"It is smaller than zero"<<endl;

}

 

 

return 0;

}

 

Question 6:

 

Write a C++ program that will compute discount amount according to the following schedule:

No discount on first 10 items.

5% on each item between 11 and 40

10% on each item between 41 and 60

20% on each item over 61

Price of one item is $10.00.

--------

For example,

Discount on 1 item is $0.00

Discount on 3 items is $0.00

Discount on 20 items is equal to: number of items x price of one item x discount rate = 20 x 10 x 0.05 = $10.00

#include <iostream>

 

using namespace std;

 

int main(){

 

int item=0;

cout<<"Enter item quantity ";

cin>>item;

double discount=0;

if(item<=10){

discount=item*10*0;

}

if(item>10 && item<41){

discount=item*10*0.05;

}

if(item>40 && item<61){

discount=item*10*0.1;

}

if(item>60){

discount=item*10*0.20;

}

printf("Discount on %i item is $%.2f",discount);

 

 

 

 

Question 7:

Write a C++ program that asks the user to enter 2 double numbers and then stores the values into n1 and n2, then asks the user to select one of the following options:

  1. Sum the numbers
  2. Sub the numbers
  3. Mul the numbers
  4. Div the numbers

and from within a SWITCH CASE statement perform the operation and print the answer to screen.

#include <iostream>

using namespace std;

 

int main(){

double n1,n2, sum=0, sub=0, mul=0, div=0;

 

cout<<"Enter one double number: "<<endl;

cin>>n1;

cout<<"Enter second double number: "<<endl;

cin>>n2;

int c;

cout<<"Enter choice\n";

cout<<"1. Sum the numbers\n"<<endl;

cout<<"2. Sub the numbers\n"<<endl;

cout<<"3. Mul the numbers\n"<<endl;

cout<<"4. Div the numbers\n"<<endl;

cin>>c;

 

switch(c) {

 

case 1 :

sum=n1+n2;

cout<<"The sum is "<<sum;

break;

 

case 2 :

sub=n1-n2;

cout<<"The difference is "<<sub;

break;

 

case 3:

mul=n1*n2;

cout<<"The multiplication is "<<mul;

break;

case 4 :

div=n1/n2;

cout<<"The difision is "<<div;

 

default :

cout<< "Invalid entry" <<endl;

}

}

Buy Now
""
1
Upload Your Assignment
Name
icon-user
Phone
icon-phone
Subjects
icon-file-code
Budgets(USD)
icon-briefcase
Deadline
date_range
Message
0 /
File Upload
cloud_uploadUpload
Previous
Next
FormCraft - WordPress form builder
Connect with us