Assignment 2.1
Assignment 2.1
QUEZON CITY
COLLEGE OF INFORMATION TECHNOLOGY EDUCATION (CITE)
ITE001- Computer Programming 1
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
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>
int main(){
cout<<" ***************************************";
cout<<"\n ***************************************";
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{
cin>>trans;
switch(trans) {
case 1: ctr=1;
do{ sum=sum+ctr;
ctr++;
} while(ctr<=num);
case 2: ctr=1;
while(ctr<=num)
ctr++;
} break;
case 3: break;
case 4: break;
case 5: break;
case 6: break;
} //end of switch
} //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