0% found this document useful (0 votes)
61 views

Assignment 2.1

The document provides instructions for an activity assignment to write a C++ program that allows a user to enter a student's name, four course codes, units, and grades. It should then compute and display the student's general weighted average (GWA) using a given formula. Sample output is provided that displays the student name, courses/units/grades, and calculated GWA. The honor pledge at the end affirms that the student has not received unauthorized help and the work is their own.

Uploaded by

RY Ma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Assignment 2.1

The document provides instructions for an activity assignment to write a C++ program that allows a user to enter a student's name, four course codes, units, and grades. It should then compute and display the student's general weighted average (GWA) using a given formula. Sample output is provided that displays the student name, courses/units/grades, and calculated GWA. The honor pledge at the end affirms that the student has not received unauthorized help and the work is their own.

Uploaded by

RY Ma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES

QUEZON CITY
COLLEGE OF INFORMATION TECHNOLOGY EDUCATION (CITE)
ITE001- Computer Programming 1

NAME: Lacido, Mary Joy O.


PROGRAM/SECTION: CS11S2
ASSESSMENT TASK: Activity 1.2 -Basic programming using C++ Input/ Output (cin/cout object)
The following question supports the attainment of Course Intended Learning Outcomes (CILO): Identify the
components, features, characteristics, and uses of C++ Language in various applications; and Design
computing-based solution using control structures, functions, arrays and other statements.

Instruction: Write a program that will let the user enter:  Student Name,  FOUR Course Code,  FOUR
Course Units and FOUR Course Grade. The program will compute and display the student's General
Weighted Average(GWA).

                                
     Variables: studName, cCode1, cCode2, cUnit1, cUnit2, cGrade1, cGrade2, totUnits, gwa=0.
                                 Formula:
                  totUnits=cUnit1 + cUnit2 + cUnits3 + cUnit4
  gwa= ((cGrade1*cUnits1)+( cGrade2*cUnits2)+( cGrade3*cUnits3)+( cGrade4*cUnits4))/ totUnits

SAMPLE OUTPUT (always include your name and section in the output - use cout to display it)
Name: Jasmin Caliwag
Section: IT11S1

Enter student name: JamesCruz


Enter course code 1: ITE001
Enter course grade 1: 95
Enter course unit 1:     4

Enter course code 2: ITE011


Enter course grade 2: 97
Enter course unit 2:     3

Student Name: JamesCruz

COURSES Units Grade


ITE001 4 95
ITE011 3 97

General Weighted Average(GWA) =  95

Source Code: paste the source code here


OUTPUT:   paste the output here...PRESS ALT PRINT SCREEN TO SCREEN SHOT THE OUTPUT

Honor Pledge

"I affirm that I have not given or received any unauthorized help on this assignment and that this work
is my own".

biksbiydb #include<iostream>

using namespace std;

int main(){

int num, ctr, trans, sum=0;

cout<<" ***************************************";

cout<<"\n * Name: *";

cout<<"\n * Section: *";

cout<<"\n ***************************************";

cout<<"\n\n Enter a number: ";cin>>num;

cout<< "\n Transaction";

cout<<"\n 1.Display the sum of 1 to " << num <<" using do while"; // not graded

cout<<"\n 2.Display ascending order from 1 to " << num << " using while"; // not graded

cout<<"\n 3.Display descending order from " << num << " to 1 using for loop";
cout<<"\n 4.Display all numbers divisible by 5 from 1 to " << num << " using while";

cout<<"\n 5.Display the product of numbers divisible by 4 from 1 to " << num <<" using do while";

cout<<"\n 6.Display the average numbers from 1 to " << num <<" using for loop";

do{

cout<<"\n\n Enter transaction: ";

cin>>trans;

switch(trans) {

case 1: ctr=1;

do{ sum=sum+ctr;

ctr++;

} while(ctr<=num);

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

case 2: ctr=1;

while(ctr<=num)

{ cout<<ctr <<" ";

ctr++;

} break;

case 3: break;

case 4: break;
case 5: break;

case 6: break;

default: cout<< "Invalid";

} //end of switch

} while(trans<=6); // end of do while

} //end of main

#include<iostream>
using namespace std;
int main() {
string student, code1, code2, code3, code4;
int unit1, unit2, unit3, unit4, grade1, grade2, grade3 , grade3, grade4, totunits1, totunits2, totunits3,
totunits4 totbill;
// cout cin the necessary data
cout<<"Enter student name: ";
getline(cin,student);
cout<<"Enter code 1 : ";
cin>>code1;
cout<<"Enter unit 1: ";
cin>>unit1;
cout<<"Enter grade 1: ";
cin>>grade1;
// compute now the total 1 = unit1 * grade1
totunits1=unit1 * grade1;
// display the total 1
cout<<" Totunits 1= " <<totunits1; // then try to run if the program computed the correctly
// since the first product is computed correctly, then copy copy paste and edit the next product
cout<<"\nEnter code 2: ";
cin>>code2;
cout<<"Enter unit 2: ";
cin>>unit2;
cout<<"Enter grade 2: ";
cin>>grade2;
// compute now the total 2 = unit2 * grade2
totunits2=unit2 * grade2;
// display the total 2
cout<<" Totunits 3= " <<totunits3;
cout<<"\nEnter code 3 ";
cin>>code3;
cout<<"Enter unit 3: ";
cin>>unit3;
cout<<"Enter grade 2: ";
cin>>grade3;
// compute now the total 2 = unit2 * grade2
totunits3=unit3 * grade3;
// display the total 3
cout<<" Totunits 3= " <<totunits3;
cout<<"\nEnter code 4: ";
cin>>code4;
cout<<"Enter unit 4: ";
cin>>unit4;
cout<<"Enter grade 4: ";
cin>>grade4;
// compute now the total 4 = unit4 * grade4
totunits4=unit4 * grade4;
// display the total 4
cout<<" Totunits 4 = " <<totunits4;

// NOW for final code display the summary of the purchased products
//Column Heading
cout<<"\n\nStudent Name: "<<student;
cout<<"\n\n Product Name Quantity Price Total";
//call all the variables that handle the values
cout<<"\n"<<code1 <<" " << unit1<<" " <<grade1 <<" "<<totunits1;
cout<<"\n"<<code2 <<" " << unit2<<" " <<grade2 <<" "<<totunits2;
//Compute for the total bill
totbill = totunits1 + totunits2 + totunits3 + totunits4;
cout<< "\n Your total bill is "<<totbill;
}//end of main

You might also like