Lab Work W13
Task I
-Create a C++ program that checks your grade marks range
// Example program
#include <iostream>
#include <string>
using namespace::std;
int main()
{
char grade;
cout<"Enter your grade"<endl;
cin>grade;
switch(grade)
{
case 'A': cout<"your mark is between 90-100"<endl;
break;
case 'B': cout<"your mark is between 80-90"<endl;
break;
case 'C': cout<"your mark is between 70-80"<endl;
break;
case 'D': cout<"your mark is between 60-70"<endl;
break;
case 'F': cout<"your mark is between 0-60"<endl;
break;
}
}
TASK II
Create a C++ program that checks the position and rank of an employee.
TASK III
Create a C++ program that calculates the annual fee for subscribing in a health care center:
// Example program
#include <iostream>
#include <string>
using namespace::std;
int main()
{
char choice;
double annualFee;
cout<"Health CLub MENU"<endl;
cout<"______"<endl;
cout<"1:Senior"<endl;
cout<"2:ADULT"<endl;
cout<"3:STUDENT"<endl;
cout<"4:CHILD"<endl;
cout<"Enter your choice"<endl;
cin>choice;
switch(choice)
{
case 1: annualFee = 12 * 25;
break;
case 2: annualFee = 12 * 30;
break;
case 3: annualFee = 12 * 20;
break;
case 4: annualFee = 12 * 10;
break;
default: cout<"your choice is wrong"<endl;
}
cout<"Your annual fee for the subscription is: "<annualFee<endl;
}
TASK IV:
Create a C++ program that displays the position for a given salary:
// Example program
#include <iostream>
#include <string>
using namespace::std;
int main()
{
int salary;
cout<"Enter your salary"<endl;
cin>salary;
if(salary>=1501 & salary<=2000)
cout<"General Manager"<endl;
if(salary>=1001 & salary<=1500)
cout<"Manager"<endl;
}
TASK V
Create a C++ program that copy an array A values to the array B:
// Example program
#include <iostream>
using namespace::std;
int main()
{
int i, N, mark1[10],mark2[10];
cout<"How many grades are you going to enter??"<endl;
cin>N;
for (i=0;i<N;i++)
{
cin>mark1[i];
}
for (i=0;i<N;i++)
{
mark2[i]=mark1[i];
}
for (i=0;i<N;i++)
{
cout<mark2[i]<endl;
}
system("pause");
return 0;
}
TASK VI
Create a C++ program that sums the element of an array, then, displays the sum with the average value.
// Example program
#include<iostream>
usingnamespace::std;
int main()
{
int i, N, mark[10];
double total=0, average;
cout<"How many grades are you going to enter??"<endl;
cin>N;
for (i=0;i<N;i++)
{
cout<"Enter the mark number"<i<endl;
cin>mark[i];
total=total+mark[i];
}
average = total / N;
cout<"The toal mark of N mark="<total<endl;
cout<"The average mark of N mark="<average<endl;
system("pause");
return 0;
}