You are on page 1of 9

COLLEGE OF COMPUTER STUDIES & MULTIMEDIA ARTS

CCS0004L – Computer Programming 1

MACHINE PROBLEMS

Section – 1B

Submitted By
Tapia, Eira Nicole
Sy, Migz Gamueda
Santiago, Marbin Luis Martin
Selirio, Mark John G.

Submitted To:
Ms. Miles V. Ortega
PROGRAM DESCRIPTION

In This Programming, we will solve a Machine Problems using C++

Table of Variables

Variable Name Data Type Purpose

Name Char Stores the Name Entered

Ass Float ( Floating Point) Stores the Grade for Assignment 1

Sw Float ( Floating Point ) Stores the Grade for Seatwork 1

Quiz Float ( Floating Point ) Stores the Grade for Quiz 1

Exam Float ( Floating Point ) Stores the Grade for Major Exam

Ave Float ( Floating Point ) Stores the Average Grade

Gass Float ( Floating Point ) Stores the Grade for Assignment 2

Gsw Float ( Floating Point ) Stores the Grade for Seatwork 2

Gquiz Float ( Floating Point ) Stores the Grade for Quiz 2

Program Codes:

#include <iostream>

#include <stdlib.h>

using namespace std;

char name[50],choice;

float ass, sw, quiz, exam,ave;

float gass, gsw, gquiz;

void input(){

cout <<'\n'<<'\t'<<'\t'<<" GRADE CALCULATOR "<<endl;

cout <<'\t'<<'\t'<<"//////////////////////////////////////"<<endl;

cout <<'\t'<<'\t'<< "| Name: ";

cin >> name;

cout <<'\t'<<'\t'<< "| Assignment 1:--------------| ";

cin >> ass;

while(ass > 100 || ass < 0){


cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Assignment 1:--------------| ";

cin >> ass;

cout <<'\t'<<'\t'<< "| Assignment 2:--------------| ";

cin >> gass;

while(gass > 100 || gass < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Assignment 2:--------------| ";

cin >> gass;

cout <<'\t'<<'\t'<< "| Seatwork 1:----------------| ";

cin >> sw;

while(sw > 100 || sw < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Seatwork 1:----------------| ";

cin >> sw;

cout <<'\t'<<'\t'<< "| Seatwork 2:----------------| ";

cin >> gsw;

while(gsw > 100 || gsw < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Seatwork 2:----------------| ";

cin >> gsw;

cout <<'\t'<<'\t'<< "| Quiz 1:--------------------| ";

cin >> quiz;

while(quiz > 100 || quiz < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Quiz 1:--------------------| ";

cin >> quiz;


}

cout <<'\t'<<'\t'<< "| Quiz 2:--------------------| ";

cin >> gquiz;

while(gquiz > 100 || gquiz < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Quiz 2:--------------------| ";

cin >> gquiz;

cout <<'\t'<<'\t'<< "| Major Exam:----------------| ";

cin >> exam;

while(exam > 100 || exam < 0){

cout << "\n\t\t!!! INVALID INPUT !!!"<<'\n'<<"\n\t\tTry Again...\n"<<endl;

cout <<'\t'<<'\t'<< "| Major Exam:----------------| ";

cin >> exam;

void calculation(){

gass = (ass+gass)/2;

gsw = (sw+gsw)/2;

gquiz = (quiz+gquiz)/2;

exam = exam;

ave = (gass*0.10) + (gsw*0.20) + (gquiz*0.30) + (exam*0.40);

if(ave >=99 && ave <= 100){

exam = 1.00;

else if(ave >=96 && ave <= 98.9){

exam = 1.25;

else if(ave >=93 && ave <= 95.9){


exam = 1.50;

else if(ave >=90 && ave <= 92.9){

exam = 1.75;

else if(ave >=87 && ave <= 89.9){

exam = 2.00;

else if(ave >=84 && ave <= 86.9){

exam = 2.25;

else if(ave >=81 && ave <= 83.9){

exam = 2.50;

else if(ave >=78 && ave <= 80.9){

exam = 2.75;

else if(ave >=75 && ave <= 77.9){

exam = 3.00;

else if(ave >=0 && ave <= 74.9){

exam = 5.00;

else{

cout << "ERROR: INVALID INPUT SEATWORK...\n";

void printingresult(){

cout<<'\t'<<'\t'<<" __________________________________"<<endl;
cout <<'\t'<<'\t'<<"| "<<name<<" Your Average is : " << ave<<'\n'<<'\t'<<'\t'<<"| Equivalent Grade: "<<
exam<<endl;

cout<<'\t'<<'\t'<<" __________________________________"<<endl;

void loop(){

do{

input();

calculation();

printingresult();

cout <<'\t'<<'\t'<<"| Try another [Y/N] ? : ";

cin >> choice;

system ("CLS");

}while(choice == 'Y' || choice == 'y');

if (choice == 'n' || choice == 'N')

exit(0);

else {

cout<< "\n\n\t\tERROR: INVALID INPUT..."<<'\n'<<'\n';

int main() {

loop();

return 0; }
Print Screen

Invalid Input:
Valid Inputs:

Using Decimal Point

Using Whole Number


Flow Chart

Enter your Name

Shows
Showsthe
the Name Entered
Name Entered

Enter your Grade for Assignment 1

Enter your Grade for Assignment 2

Enter your Grade for Seatwork 1

Enter your Grade for Seatwork 2

Enter your Grade for Quiz 1

Enter your Grade for Quiz 2

Enter your Grade for Exam

Calculates

Shows the Average Result and Equivalent


Grade

You might also like