You are on page 1of 2

Air University, Islamabad, Pakistan

Programming Fundamentals Lab, Spring 2024


Lab_4
Total Marks 100, Due Date: 11:59 pm, Friday 1st March, 2024

Assignment Task
Problem 1: Increment and Decrement operator
Your task is to dry run this program and draw box against each statement and write the actual value in the
box, for example for int x=10 X =10

#include<iostream>
using namespace std;
int main(){
int x=10;
cout<<"value of x is :"<<x<<endl;
cout<<"value of x is :"<<--x<<endl;
x++;
cout<<"value of x is :"<<x--<<endl;
x--;
cout<<"value of x is :"<<x++<<endl;
cout<<"value of x is :"<<x++<<endl;

int sum = 0;
cout<<"the value of sum is ="<<sum++<<endl;
sum = x--;
cout<<"the value of sum is ="<<sum--<<endl;
sum++;
cout<<"the value of sum is ="<<sum--<<endl;
sum += x++;
cout<<"the value of sum is ="<<sum<<endl;

sum = sum++ + x++;


cout<<"the value of sum is ="<<sum<< "x is = "<<x<<endl;

sum = sum-- - x--;


cout<<"the value of sum is ="<<sum<< "x is = "<<x<<endl;
return 0;

1
Air University, Islamabad, Pakistan
Programming Fundamentals Lab, Spring 2024
Lab_4
Total Marks 100, Due Date: 11:59 pm, Friday 1st March, 2024

Problem 2: Package shipping offer


Write a C++ program for a company that sells items online. There are different shipping promotional
offers. The shipping charges are 1000 PKR. If a customer spends more than 30,000 PKR to purchase
items online then there will be a 75% discount on shipping charges. If purchasing items are greater than
20,000 PKR and less than 30,000 then there will be a 50% discount on shipping charges. If purchasing
items are up to 20,000 PKR and greater than 10,000 then there will be a 25% discount on shipping
charges. There will be no discount on shipping charges for items worth less than 10,000 PKR.

Important Notes: Comment each statement or block of statements and explain the purpose of each
statement or block of statements. The C++ program should compile and run without any errors against the
output given in this assignment. Marks or points will be deducted based on the following points:
 Formatting [10 points]
 Naming convention for variables [10 points]
 Comments [10 points]
 Missing loop where required [10 points]
 Program doesn’t compile and run [70 points ]
 Source code (java files) and executable file (.class file) missing [100 points]
Turn in to student’s portal (teams)
1) Write the program, follow steps, execute your program, capture output and submit a pdf file to
the portal (teams).
2) Submit source code: Shipping.cpp,
3) Execute all possible test cases and document your results in pdf against different inputs
4) We discussed memory types in detail. Copying, plagiarism, and sharing your answers with other
students is strictly prohibited and disciplinary action will be initiated against such students

You might also like