Grading System Code In Dev C++

  1. Dev C++ Programs
  2. Grading System Code In Dev C 5
  3. Grading System Code In Dev C Download
  • C Programming Tutorial
  • C Programming useful Resources

May 29, 2013  Grading System - Visual C (Simple database for grading system) black label. Unsubscribe from black label? Cancel Unsubscribe. Subscribe Subscribed Unsubscribe 247. I ran your code and minus the #include for everything ran perfectly. The only solutions I've seen before was to restart your IDE and see if that remedies your issue, maybe start a new project and copy paste your code into that main.cpp. C Program to Process Marks of Student and Display Grade. The C program to process marks of student and display grade checks for multiple conditions on the input marks and then decides the grade of a student. This program is written using Dev C compiler version 4.9.9.2 installed on Windows 7 64-bit computer.

  • Selected Reading

An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.

Syntax

The syntax of an if...else statement in C programming language is −

If the Boolean expression evaluates to true, then the if block will be executed, otherwise, the else block will be executed.

C programming language assumes any non-zero and non-null values as true, and if it is either zero or null, then it is assumed as false value.

Flow Diagram

Example

When the above code is compiled and executed, it produces the following result −

If...else if...else Statement

An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions using single if...else if statement.

Grading System Code In Dev C++

When using if...else if..else statements, there are few points to keep in mind −

Dev C++ Programs

Grading
  • An if can have zero or one else's and it must come after any else if's.

  • An if can have zero to many else if's and they must come before the else.

  • Once an else if succeeds, none of the remaining else if's or else's will be tested.

Syntax

The syntax of an if...else if...else statement in C programming language is −

Example

When the above code is compiled and executed, it produces the following result −

c_decision_making.htm
employeesalary

Grading System Code In Dev C 5

Input Processing Output
1) Enter Code
1) Manager:Salary 2) if(code1) Manager Salary
Print Manager Salary
2) HourlyWorker: 3) if(code2) HourlyW .....
Enter Hours
if(hours<=40)
hours calculate: hours*rate
rate else
salary = 40.0 * hrRate + ( hours - 40 ) * hrRate * 1.5;
print
3) Commisions 4) if(code3) CommissionW...
Enter Sale
sale calculate: (sale*0.57)+250
5.7% print
4) PieceWorker: 5) if(code4) PieceW........
numOfProduct Enter number of product
Rate Enter rate
calculate:rate*numOfProduct
print
5) PayCode(1= Manager; 2=hourly worker; 3=Commissions Worker; 4=pieceworker) */
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
class EmployeeSalary
{
public:
/* hourly workers*/
double CalculateHourlySalary(int hrRate, int hours)
{
if ( hours <= 40 )
salary = hours * hrRate;
else
salary = 40.0 * hrRate + ( hours - 40 ) * hrRate * 1.5;
return salary;
}
/*Commission workers*/
double getCommissionHourlySalary(double sale)
{
sale =(sale* 0.057 )+ 250;
return sale;
}
/* Piece Workers*/
double getPieceWorkerHourlySalary(int product, int rate)
{
int pro = product * rate;
return pro;
}
void instruct()
{
cout<<'The Purpose of this Program is to calculate each employees pay rate by entering the employee paycode '
'for example, when the user type in 1, it will calculate the'
'Manager salary, 2 for hourlyWorkers,'
' 3 for Commission Workers and 4 for PieceWorkers '
'and the program itself will do '
'the calculation for that particular employee'
' and when ever the user Enter -1 as the PayCode ,program will executed.'<<endl;
}
private:
double salary;
};
int main()
{
EmployeeSalary salary;
int paycode;
double sal;
int hrRate;
int product;
int rate;
int hours;
int sale;
salary.instruct();
cout<<endl<<endl;
cout<<' *******************************************'<<endl;
cout<<' %%%%%%% [-1] To End The Program: %%%%%%%%'<<endl;
cout<<' *******************************************'<<endl;
cout<<' **** [1] Manager PayCode: ******'<<endl;
cout<<' **** [2] Hourly worker PayCode: ******'<<endl;
cout<<' **** [3] Commission worker PayCode: ******'<<endl;
cout<<' **** [4] Piece worker PayCode: ******'<<endl;
cout<<' *******************************************'<<endl;
while(paycode!=-1)
{
cout<<endl;
cout<<' Enter PayCode:'<<' '<<setiosflags( ios::fixed | ios::showpoint );
cin>>paycode;
cout<<'*******************************************'<<endl;
cout<<endl;
if(paycode1)
{
/*Manager Fixed salary */
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'^^^^ Manager PayCode Has been selected ^^^^'<<endl;
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'Enter Salary: ';
cin>>sal;
cout<<'Manager's salary is:$ '<<setprecision(2)<<sal<<endl;
cout<<endl;
cout<<endl;
system('pause');
}
if(paycode2)
{
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'^^^^^^^^ Hourly Worker PayCode ^^^^^^^^'<<endl;
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'Enter Hour Rate:$ ';
cin>>hrRate;
cout<<'Enter hours worked: ';
cin>>hours;
cout<<'Hourly worker's salary is:$ '<<setprecision(2)<<salary.CalculateHourlySalary(hrRate,hours)<<endl;
cout<<endl;
system('pause');
}
if(paycode3)
{
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'^^^^^^^ Commission Workers PayCode ^^^^^^'<<endl;
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'Enter weekly sale: ';
cin>>sale;
cout<<'Commission worker's hourly is:$ '<<setprecision(2)<<salary.getCommissionHourlySalary(sale)<<endl;
cout<<endl;
system('pause');
}
if(paycode4)
{
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'^^^^^^^^^^ Piece Worker PayCode ^^^^^^^^^'<<endl;
cout<<'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'<<endl;
cout<<'Enter Number of product: ';
cin>>product;
cout<<'Enter rate per each pieces sold:$ ';
cin>>rate;
cout<<'Piece worker's salary: '<<setprecision(2)<<salary.getPieceWorkerHourlySalary(product,rate)<<endl;
system('pause');
}
else
cout<<'Input Error'<<endl;
}
return 0;
}

Grading System Code In Dev C Download

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Comments are closed.