0% found this document useful (0 votes)
88 views4 pages

LE1 (SequentialProgStruct 4Q1516)

This document provides instructions for a laboratory exercise assignment. It asks students to complete two programming problems in C++. The first problem involves calculating the number of telephone lines needed for a direct connection network of a given number of telephones. The second problem involves writing a program that prompts a user for miles driven and gallons of gas used, calculates miles per gallon, and fills out a table converting the values to kilometers and liters. It provides sample test data and evaluation criteria for grading the assignment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views4 pages

LE1 (SequentialProgStruct 4Q1516)

This document provides instructions for a laboratory exercise assignment. It asks students to complete two programming problems in C++. The first problem involves calculating the number of telephone lines needed for a direct connection network of a given number of telephones. The second problem involves writing a program that prompts a user for miles driven and gallons of gas used, calculates miles per gallon, and fills out a table converting the values to kilometers and liters. It provides sample test data and evaluation criteria for grading the assignment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Laboratory 1 (Sequential Program Structure) Date

Exercise #
Name Login/ Username

File Name: LE1_Surname.doc


To be uploaded in blackboard

1.) Answer Exercise 2.5 (page 63)

(Telephony) In a directly connected telephone network, all telephones are connected and don’t
require a central switching station to establish calls between two telephones. The number of lines
needed to maintain a directly connected network for n telephones is given by this formula:

number of lines needed = n (n - 1) / 2

Example: n=4
number of lines needed = 6

n = 100
number of lines needed = 4950

2.) Answer Exercise 3.4 (page 112)

Write, compile and run a C++ program that displays the following prompts:
Enter the miles driven:
Enter the gallons of gas used:

After each prompt is displayed, your program should use a cin statement to accept data from the
keyboard for the displayed prompt. After the number of gallons of gas used has been entered,
your program should calculate and display the miles per gallon (mpg). This value should be
included in a message and calculated by using the formula miles per gallon = miles / gallons
used. Verify your program by using the following test data:

Test data set 1: miles = 276, gas = 10 gallons


Test data set 2: miles = 200, gas = 15.5 gallons
After finishing your verification, use you program to complete the following chart. (Make sure to
convert the miles driven to kilometers driven and gallons used to liters used, and then compute
the kilometers per liter.)

Conversion: 1 mile = 1.60934 kilometer and 1 gallon = 3.78541 liter

Miles Gallons Mpg Km Liters Km/L


Driven Used Driven Used

250 16.00

275 18.00

312 19.54

296 17.39
Laboratory Exercise Score Sheet

Criteria Score

1.) Intelligent/Descriptive naming of variables for number 1 5

2.) Use Comment (name/course code and section/ date/program description) 5

3.) Proper Program Indention for problem number 1 5

4.) Displays Message prompt for problem number 1 5

5.) Correct Logic for problem number 1 15

6.) Correct Output for problem number 1 10

7.) Intelligent/Descriptive naming of variables for number 2 5

8.) Use Comment (name/course code and section/ date/program description) 5

9.) Proper Program Indention for problem number 2 5

10.) Displays Message prompt for problem number 2 5

11.) Correct Logic for problem number 2 15

12.) Correct Output for problem number 2 10

13.) Exercise finished/submitted within time-frame 10

Total 100

_________________________ _______________
Engr. Cristina A. Pascua Date
(Instructor)
Answer Sheet

Laboratory Exercise 1 (Sequential Program Structure) Date

Name Course Code/Section

File Name: LE1_Surname.doc or LE1_Surname.docx

To be uploaded in blackboard

1.)
C++ Program

2.)
C++ Program

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy