0% found this document useful (0 votes)
52 views7 pages

CS201 Assignment 1 Correct Solution Spring 2025

This document provides the solution for CS201 Assignment 1 due on May 2, 2025, including submission instructions and a sample C++ code for a cafe billing system. It emphasizes the importance of submitting the code in the correct format and includes contact information for paid solutions. Additionally, it warns against copying solutions directly and encourages students to modify their submissions.

Uploaded by

samrasatar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views7 pages

CS201 Assignment 1 Correct Solution Spring 2025

This document provides the solution for CS201 Assignment 1 due on May 2, 2025, including submission instructions and a sample C++ code for a cafe billing system. It emphasizes the importance of submitting the code in the correct format and includes contact information for paid solutions. Additionally, it warns against copying solutions directly and encourages students to modify their submissions.

Uploaded by

samrasatar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk

CS201 ASSIGNMENT 1 SOLUTION SPRING 2025

Due Date: 2-May-2025


Total Marks: 20

Join Group for [Assignments, GDBs, Quizzes] Solution Free Files


https://chat.whatsapp.com/Bto6NP8Af6h1Sz3Z2O7dUK

DO NOT COPY PASTE THE SAME

FOR PAID SOLUTION WITH YOUR ID, NAME


CONTACT US WHATSAPP 03162965677

Assignment Submission Instruction:


You must submit only the ".cpp" file of your code on the assignments interface from your LMS
account.

An assignment submitted in any other format will not be accepted and will receive zero marks. No
excuses will be accepted for submitting a solution file in any other format.

Note: Remember that if you have not used your name and student id in the program your marks will be
deducted.

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk

SOLUTION

CODE

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main() {
string name = "VU Answer - 03162965677";
string vuID = "BS123456789";

// Display name and VU ID


cout << "Name: " << name << "\n";
cout << "VU-ID: " << vuID << "\n";

// Ask the user to enter the numeric part of the VU-ID


string numericID;
cout << "\nEnter numeric part of VU-ID: ";
cin >> numericID;

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk
// Extract the middle five digits from the numeric part of VU-ID
string midDigits = numericID.substr(2, 5);
cout << "\nExtracted Middle Five Digits: " << midDigits << "\n";

// Menu items and prices


cout << "\n=== Welcome to C++ Cafe ===\n";
cout << "------ MENU ------\n";
cout << "1. Burger - Rs. 250\n";
cout << "2. Pizza - Rs. 500\n";
cout << "3. Fries - Rs. 150\n";
cout << "4. Sandwich - Rs. 200\n";
cout << "5. Cold Drink - Rs. 100\n";

// Use the extracted middle five digits as quantities for each item
int qBurger = midDigits[0] - '0';
int qPizza = midDigits[1] - '0';
int qFries = midDigits[2] - '0';
int qSandwich = midDigits[3] - '0';
int qDrink = midDigits[4] - '0';

// Prices of the menu items


const int pBurger = 250;
const int pPizza = 500;

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk
const int pFries = 150;
const int pSandwich = 200;
const int pDrink = 100;

// Subtotal calculations for each item


int sBurger = qBurger * pBurger;
int sPizza = qPizza * pPizza;
int sFries = qFries * pFries;
int sSandwich = qSandwich * pSandwich;
int sDrink = qDrink * pDrink;

// Display the subtotal for each item


cout << fixed << setprecision(0);
cout << "\nBurger (" << qBurger << " x Rs. " << pBurger << ") = Rs. " << sBurger << "\n";
cout << "Pizza (" << qPizza << " x Rs. " << pPizza << ") = Rs. " << sPizza << "\n";
cout << "Fries (" << qFries << " x Rs. " << pFries << ") = Rs. " << sFries << "\n";
cout << "Sandwich (" << qSandwich << " x Rs. " << pSandwich << ") = Rs. " << sSandwich
<< "\n";
cout << "Cold Drink (" << qDrink << " x Rs. " << pDrink << ") = Rs. " << sDrink << "\n";

// Total bill before discount


int total = sBurger + sPizza + sFries + sSandwich + sDrink;
double discount = 0;

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk

// Check if discount applies


if (total >= 5000) {
cout << "\nSurprise! You've unlocked a 10% discount\n";
discount = total * 0.10;
}

// Calculate the net payable amount


double netAmount = total - discount;

// Display final billing details


cout << "\n==== Final Bill ====\n";
cout << "Total before discount: Rs. " << total << "\n";
cout << "Discount: Rs. " << discount << "\n";
cout << "Net Payable Amount: Rs. " << netAmount << "\n";

cout << "\nThank you for visiting C++ Cafe!\n";

return 0;
}

OUTPUT SCREENSHOT

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677
MORE SOLUTIONS, HANDOUTS AND PAST PAPERS FREELY VISIT

VUAnswer.pk

REGARD - SARIM
WHATSAPP +923162965677

PLEASE NOTE:
Don't copy-paste the same answer.
Make sure you can make some changes to your solution file before
submitting copy paste solution will be marked zero.
If you found any mistake then correct yourself and inform me.
Before submitting an assignment must check your assignment requirement
file.
If you need some help or question about file and solutions feel free to ask.

FOR FREE ASSIGNMENTS SOLUTIONS VISIT

VUAnswer.pk

FOR PAID ASSIGNMENTS CORRECT SOLUTION

WhatsApp: +923162965677

You might also like