0% found this document useful (0 votes)
22 views2 pages

Assign No 1 Fall 2023 09102023 042910pm

This document provides instructions for Assignment 1 for a Computer Programming course. It outlines 3 questions to program, including calculating customer bills for a cable company based on customer type, creating a four-function calculator for fractions, and determining the type and values of roots for a quadratic equation based on the discriminant. It provides details on submission procedures through the university LMS by a specified due date and notes that plagiarized assignments will not be accepted or graded.
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)
22 views2 pages

Assign No 1 Fall 2023 09102023 042910pm

This document provides instructions for Assignment 1 for a Computer Programming course. It outlines 3 questions to program, including calculating customer bills for a cable company based on customer type, creating a four-function calculator for fractions, and determining the type and values of roots for a quadratic equation based on the discriminant. It provides details on submission procedures through the university LMS by a specified due date and notes that plagiarized assignments will not be accepted or graded.
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/ 2

Bahria University, Islamabad Campus

Department of Computer Sciences


Assignment No. 1
(Fall 2023 Semester)
Course: Computer Programming Date: 9 - 10 -23

Max Marks: 10

Student’s Name: _____________________________Enroll No:_________________________________

Submission Procedure
• Make and execute the program and then submit a single MS word file containing source code of
your WORKING program. Please add a screen shot of output screen in the word file.
• Assignments are to be submitted through Bahria University LMS only. Assignments cannot be
accepted through any other channel (email etc.). Assignments sent through other channels cannot
be marked.
• ZERO credit for all plagiarized assignments.
• This is an INDIVIDUAL and NOT a group assignment.
• 90% marks will be for meeting all requirements while 10% marks will be for adhering to good
design and good programming practices.
• Submission Date: Assignments are to be submitted on or before October 16th, 2023. The LMS
system will not be able to accept late submissions.

Question No. 1
This programming example demonstrates a program that calculates a customer’s bill for a local
cable company. There are two types of customers: residential and business. There are two rates for
calculating a cable bill: one for residential customers and one for business customers.
For residential customers, the following rates apply:
• Bill processing fee: $4.50
• Basic service fee: $20.50
• Premium channels: $7.50 per channel
For business customers, the following rates apply:
• Bill processing fee: $15.00
• Basic service fee: $75.00 for first 10 connections, $5.00 for each additional connection
• Premium channels: $50.00 per channel for any number of Connections
The program should ask the user for an account number (an integer) and a customer code. Assume
that R or r stands for a residential customer, and B or b stands for a business customer.

Input The customer’s account number, customer code, number of premium channels to
which the user subscribes, and, in the case of business customers, number of basic
service connections.
Output Customer’s account number and the billing amount.
Question No. 2
Create a four-function calculator for fractions. Here are the formulas for the four arithmetic
operations applied to fractions:

Addition: a/b + c/d = (a*d + b*c) / (b*d)


Subtraction: a/b - c/d = (a*d - b*c) / (b*d)
Multiplication: a/b * c/d = (a*c) / (b*d)
Division: a/b / c/d = (a*d) / (b*c)
The user should type the first fraction, an operator, and a second fraction then program should
display the result.

Question No. 3
The roots of the quadratic equation 𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄, 𝒂 ≠ 𝟎 are given by the following formula:

−𝒃 ± √𝒃𝟐 − 𝟒𝒂𝒄
𝟐𝒂
In this formula, the term 𝒃𝟐 − 𝟒𝒂𝒄 is called the discriminant. If 𝒃𝟐 − 𝟒𝒂𝒄 = 𝟎, then the
equation has a single (repeated) root. If 𝒃𝟐 − 𝟒𝒂𝒄 > 𝟎, the equation has two real roots. If 𝒃𝟐 −
𝟒𝒂𝒄 < 𝟎, the equation has two complex roots.
Write a C++ program that prompt the user to input the value of a (the coefficient of 𝑥 2 ), b (the
coefficient of 𝑥), and c (the constant term) and outputs the type of roots of the equation.
Furthermore, if 𝒃𝟐 − 𝟒𝒂𝒄 ≥ 𝟎, the program should output the roots of the quadratic equation.

****************************************************

You might also like