Solution Manual for C++ Programming From Problem Analysis to Program Design 6th Edition by Malik ISBN 1133626386 9781133626381 - Download The Complete Set In PDF DOCX Format
Solution Manual for C++ Programming From Problem Analysis to Program Design 6th Edition by Malik ISBN 1133626386 9781133626381 - Download The Complete Set In PDF DOCX Format
_____ Follow the link below to get your download now _____
http://testbankpack.com/download/solution-manual-for-c-
programming-from-problem-analysis-to-program-design-6th-
edition-by-malik-isbn-1133626386-9781133626381/
http://testbankpack.com/download/solution-manual-for-c-programming-
from-problem-analysis-to-program-design-8th-edition-by-malik-
isbn-9781337102087/
http://testbankpack.com/download/test-bank-for-c-programming-from-
problem-analysis-to-program-design-8th-edition-by-malik-
isbn-9781337102087/
http://testbankpack.com/download/test-bank-for-animal-diversity-7th-
edition-hickman-roberts-keen-larson-
eisenhour-0073524255-9780073524252/
http://testbankpack.com/download/solution-manual-for-experience-
sociology-3rd-edition-by-croteau-hoynes-isbn-1259921662-9781259405235/
http://testbankpack.com/download/solution-manual-for-marriages-and-
familes-8th-edition-benokraitis-0205918190-9780205918195/
http://testbankpack.com/download/solution-manual-for-ethics-1st-
edition-by-camp-isbn-1133308910-9781133308911/
Solution Manual for Human Anatomy 8th Edition Marieb
Wilhelm Mallatt 0134243811 9780134243818
http://testbankpack.com/download/solution-manual-for-human-
anatomy-8th-edition-marieb-wilhelm-mallatt-0134243811-9780134243818/
Full link download C++ Programming From Problem
Analysis to Program Design 6th Edition by Malik
Test bank:
https://testbankpack.com/p/test-bank-for-c-programming-from-
problem-analysis-to-program-design-6th-edition-by-malik-isbn-
1133626386-9781133626381/
Chapter 1
1. a. false; b. false; c. true; d. false; e. false; f; false; g. false; h. true; i. true; j. false; k. true; l. false
2. The basic commands that a computer performs are input (get data), output (display result), storage, and
performance of arithmetic and logical operations
3. Central processing unit (CPU), main memory (MM), and input/output devices.
4. Secondary storage permanently stores programs and data.
5. An operating system monitors the overall activity of the computer and provides services. Some of these services
include memory management, input/output activities, and storage management.
6. The two types of programs are system programs and application programs.
7. In machine language the programs are written using the binary codes while in high-level language the program
are closer to the natural language. For execution, a high-level language program is translated into the machine
language while a machine language need not be translated into any other language.
8. A program written in a high-level language is called a source program.
9. Because the computer cannot directly execute instructions written in a high-level language, a compiler is needed
to translate a program written in high-level language into machine code.
10. A compiler reports syntax errors.
11. Every computer directly understands its own machine language. Therefore, for the computer to execute a
program written in a high-level language, the high-level language program must be translated into the
computer’s machine language.
12. Instructions in a high-level language are closer to a natural language, such as English, and therefore are easier to
understand and learn than machine language.
13. In linking an object program is combined with other programs in the library, used in the program, to create the
executable code.
14. A well-analyzed problem leads to a well-designed algorithm. Moreover, a program that is well analyzed is
easier to modify as well as spot and fix errors.
15. To find the weighted average of the four test scores, first you need to know each test score and its weight. Next,
you multiply each test score with its weight, and then add these numbers to get the average. Therefore,
1. Get testScore1, weightTestScore1
2. Get testScore2, weightTestScore2
3. Get testScore3, weightTestScore3
4. Get testScore4, weightTestScore4
5. weightedAverage = testScore1 * weightTestScore1 +
testScore2 * weightTestScore2 +
testScore3 * weightTestScore3 +
testScore4 * weightTestScore4;
16. a. Get quarters
b. Get dimes
c. Get nickels
d. Get pennies
e. changeInPennies = quarters * 25 + dimes * 10 + nickels * 5
+ pennies
17. To find the price per square inch, first we need to find the area of the pizza. Then we divide the price of the
pizza by the area of the pizza. Let radius denote the radius and area denote the area of the circle, and
price denote the price of pizza. Also, let pricePerSquareInch denote the price per square inch.
a. Get radius
b. area = π * radius * radius
c. Get price
d. pricePerSquareInch = price / area
18. To calculate the selling price of an item, we need to know the original price (the price the store pays to buy) of
the item. We can then the use the following formula to find the selling price:
sellingPrice = (originalPrice + originalPrice × 0.80) × 0.90
The algorithm is as follows:
a. Get originalPrice
b. Calculate the sellingPrice using the formula:
sellingPrice = (originalPrice + originalPrice × 0.80) × 0.90
The information needed to calculate the selling price is the original price and the marked-up percentage.
19. To calculate the area of a triangle using the given formula, we need to know the lengths of the sides―a, b, and
c―of the triangle. Next, we calculate s using the formula:
s = (1/2)(a + b + c)
and then calculate the area using the formula:
area = sqrt(s(s-a)(s-b)(s-c))
where sqrt denotes the square root.
The algorithm, therefore, is:
a. Get a, b, c
b. s = (1/2)(a + b + c)
c. area = sqrt(s(s-a)(s-b)(s-c))
The information needed to calculate the area of the triangle is the lengths of the sides of the triangle.
20. Suppose that billingAmount denotes the total billing amount, numOfItemsOrdered denotes the
number of items ordered, shippingAndHandlingFee denotes the shipping and handling fee, and price
denotes the price of an item. The following algorithm computes and outputs the billing amount.
a. Enter the number of items bought.
b. Get numOfItemsOrdered
c. billingAmount = 0.0;
d. shippingAndHandlingFee = 0.0;
e. Repeat the following for each item bought.
i. Enter the price of the item
ii. Get price
iii. billingAmount = billingAmount + price;
f. if billingAmount < 200
shippingAndHandlingFee = 10 * numOfItemsOrdered;
g. billingAmount = billingAmount + shippingAndHandlingFee
i. Print billingAmount
21. Suppose that numOfPages denoes the number of pages to be faxed and billingAmount denotes the
total charges for the pages faxed. To calculate the total charges, you need to know the number of pages faxed.
If numOfPages is less than or equal to ten, the billing amount is services charges plus (numOfPages ×
0.20); otherwise, billing amount is service charges plus 10 × 0.20 plus (numOfPages - 10) × 0.10.
That is,
You can now write the algorithm as follows:
a. Get numOfPages.
b. Calculate billing amount using the formula:
if (numOfPages is less than or equal to 10)
billingAmount = 3.00 + (numOfPages × 0.20);
otherwise
billingAmount = 3.00 + 10 × 0.20 + (numOfPages - 10) × 0.10;
22. Suppose amountWithdrawn denotes the amount to be withdrawn, serviceCharge denotes the
service charges, if any, and accountBalance denotes the total money in the account.
You can now write the algorithm as follows:
a. Get amountWithdrawn.
b. if amountWithdrawn > 500
Print "The maximum amount that can be drawn is $500"
otherwise (if accountBalance <= 0)
Print "Account balance is <= 0. You cannot withdraw any money. "
Otherwise
{
if (amountWithdrawn > accountBalance)
{
Print "Insufficient balance. If you withdraw, services charges
will be $25.00. Select Yes/No."
if (Yes)
{
if (amountWithdrawn > 300)
serviceCharge = (amountWithdrawn – 300) * 0.04;
otherwise
serviceCharge = 0;
d. To print the names of all the students whose test score is the same as the highest test score, compare the test
score of each student with the highest test score and if they are equal print the name. The following
algorithm accomplishes this
Repeat the following for each student in class:
i. Get studentName and testScore
ii.
if (testScore is equal to highestTestScore)
print studentName
You can use the solutions of the subproblems obtained in parts a to d to design the main algorithm as follows:
1. Use the algorithm in part a to find the average test score.
2. Use the algorithm in part b to print the names of all the students whose score is below the average test
score.
3. Use the algorithm in part c to find the highest test score.
4. Use the algorithm in part d to print the names of all the students whose test score is the same as the highest
test score
Chapter 2
1. a. false; b. false; c. false; d. true; e. true; f. false; g. true; h. true; i. false; j. true; k. false
2. a, b, d, e, j
3. b, d, e
4. A keyword is a reserved word and is defined by the system. A keyword cannot be redefined in a program. A
user-defined identifier can be redefined.
5. The identifiers firstName and FirstName are not the same. C++ is case sensitive. The first letter of
firstName is lowercase f while the first character of FirstName is uppercase F. So these identifiers
are different
6 a. 7
b. 3
c. 3
d. -2
e. 4.4
f. 25.5
g. 26
h. 21.75
7. a. 3
b. Not possible. Both the operands of the operator % must be integers. Because the second operand, w, is
a floating-point value, the expression is invalid.
c. Not possible. Both the operands of the operator % must be integers. Because the first operand, which is y +
w, is a floating-point value, the expression is invalid .
d. 38.5
e. 1
f. 2
g. 2
h. 420.0
8. a, b, c, e, i, j, and k are valid;
d, f, and g are invalid because the left side of an expression must be a variable. h is invalid because the
operands of the mod operator must be integers.
9. 7
10. Variable declarations in Lines 2, 4, 5 and 6 are correct.
Variable declaration in Line 1 is incorrect because the left side of the assignment operator must be a variable,
and the data type of the variable must be specified. A correct declaration is:
int age = 55; //Line 1
The variable declaration in Line 3 is incorrect because strings are enclosed in double quotation marks, and the
semicolon at the end of the statement is missing.
string message = "First test is on Monday"; //Line 3
11. a and c are valid
12. a. int x, y;
x = 25;
y = 18;
b. int temp = 10;
char ch = 'A';
c. x = x + 5;
d. double payRate = 12.5;
e. tempNum = firstNum;
f. temp = x;
x = y;
y = temp;
g. cout << x << " " << y << " " << x + 12 / y - 18 << endl;
h. char grade = 'A';
i. int num1, num2, num3, num4;
j. x = static_cast<int>(z + 0.5);
13. a. 32 * a + b
b. '8'
c. "Julie Nelson"
d. (b * b – 4 * a * c) / (2 * a)
e. (a + b) / c * (e * f) – g * h
f. (–b + (b * b – 4 * a * c)) / (2 * a)
14. x = 6
y = 29
z = 3
w = -10
15. x = 28
y = 35
z = 1
w = 22.00
t = 6.5
16. a. x = 2, y = 5, z = 6
b. x + y = 7
c. Sum of 2 and 6 is 8
d. z / x = 3
e. 2 times 2 = 4
17. a. 0.50
b. 24.50
c. 37.6
d. 8.3
e. 10
f. 38.75
18. a. cout << endl; or cout << "\n"; or cout << '\n';
b. cout << "\t";
c. cout << "\"";
19. a and c are correct
20. a. firstName
b. discountedPrice
c. numOfJuiceBottles
d. milesTravelled
e. highestTestScore
21. a. int num1;
int num2;
b. cout << "Enter two numbers separated by spaces." << endl;
c. cin >> num1 >> num2;
d. cout << "num1 = " << num1 << "num2 = " << num2
<< "2 * num1 – num2 = " << 2 * num1 – num2 << endl;
22. A correct answer is:
#include <iostream>
int main()
{
int testScore, projectScore;
double temp;
double payCheck;
int newTemp;
int first;
double hoursWorked;
testScore = 88;
projectScore = 22;
cout << testScore << " " << projectScore << endl;
temp = 82;
newTemp = testScore + 2 * projectScore;
first = 2 * TOP_NUM;
cout << first << " " << TOP_NUM << endl;
return 0;
}
int main()
{
int count, sum;
double x;
count = 1;
sum = count + PRIME;
x = 25.67; // x = 25.67;
newNum = count * 1 + 2; //newNum = count * ONE + 2;
sum = sum + count; //sum + count = sum;
x = x + sum * count; // x = x + sum * COUNT;
cout << " count = " << count << ", sum = " << sum
<< ", PRIME = " << PRIME << endl;
return 0;
}
#include <iostream>
#include <string>
int main()
{
int temperature; // int temp;
string first, last; // string first;
cout << "Enter first name: "; // cout << "Enter first name: ";
cin >> first; // cin >> first
cout << endl;
cout << "Enter last name: "; // cout << "Enter last name: ;
cin >> last;
cout << endl;
// cout << first << " " << last << today’s temperature is: ";
// << temperature << endl;
cout << first << " " << last << " today’s temperature is: "
<< temperature << endl;
return 0;
}
30.
a b c sum
sum = a + b + c; 3 5 14.1 22
c /= a; 3 5 4.7 22
b += c – a; 3 6 4.7 22
a *= 2 * b + c; 50 6 4.7 22
31. (The user input is shaded.)
a = 25
Enter two integers: 20 15
Name: Miller
Id: 3417
Mystery number: 3689
33.
#include <iostream>
#include <string>
int main()
{
string firstName, lastName;
int num;
double salary;
salary = num * X;
cout << "Name: " << firstName << BLANK << lastName << endl;
Discovering Diverse Content Through
Random Scribd Documents
BATHSEBA SAARENMAALLA.
Henkilöt:
Vana-kai. Niin, sepä se, mitä sinä siellä! (alkaa laskeutua alas
uunin pankolta).
Vana-kai. Mitä…?
Viiu. Se on jo vanha mies, kun takaisin tulee, sanon minä.
Vana-kai. Ole nyt vaiti, ei sieltä ketään tule. Enpä olisi uskonut,
että sinä Antsin tähden noin tuskaan tulisit.
Vana-kai. Kuinka sen kirjeen laita oikein oli, — jos sinä kertoisit
vielä kerran.
Viiu. Nyt voit kysyä niinkuin pappi ripillä, mutta minä en hiiskahda
sanaakaan.
Vana-kai. En.
Ants. Kiiltävä raha niinkuin suurilla saksoilla. Nyt sitä ollaan herraa,
eletään kuin viimeistä päivää. Tänään syödään ja juodaan ja
mässätään, annetaan suuta sorjan tytön, — huomenna asetutaan
kanuunan suun eteen, pyydetään: hei, toveri siellä, ammuppas pari
naulaa rautaa tästä piskuisesta koneesta läpi, joka rinnassa
raksuttaa.
Ants. Tule nyt vaan, Viiu, — istu tuohon, paina ruunun rengin
polvea, likistetään nyt viimeisiä kertoja, — likistetään lähemmäksi, —
noin… Sattuiko, oliko liian kovasti, — ei ole minulla paroonin kourat,
— ei ole maidossa pestyt nämä käpälät, isomoukarin varressa ovat
kovettuneet. Ehkä ne nyt siliävät, kun alkavat pyssyä pidellä.
Vana-kai (itkien.) Että ne nyt sinut sentään ottivat, Ants, —
umpeen painamatta minunkin silmäni jäävät, kun kuolen.
Viiu. Ei ole.
Ants. Mitä sinä niin allapäin käyt… Ettäkö sinun on minua ikävä? —
Leskeksi jäät, uutta miestä vaan et saa, — sieltä kaukaakin minä
sinua kiinni pitelen. — Onko sinun minua ikävä, Viiu?
Ants. Anna tänne, — minä etsin. Näe, — tuossa siitä on, ala lukea.
"Ja David lähetti ja antoi kysyä vaimoa ja sanoi: eikö tämä ole
Bathseba, Eliamin tytär, Urian, sen Hethiläisen emäntä?"
(Purskahtaa itkuun).
Ants (ottaa kirjan). Mutta nyt minä luen täältä muutamia värssyjä
eteenpäin.
(Sulkee kirjan).
Viiu, kun sinä tänään tulit paroonin luota, etkö tiennyt, mitä
kirjeessä seisoi?
Ants. Ja sinä…
Ants. Älä tule lähelle, taikka… Älä tartu minuun, minä en tiedä,
mitä teen… (Vaipuu lavitsalle, sisällisesti murtuneena), Bathseba,
köyhän miehen ainoa karitsa!
SOTILAAN ÄITI.
Oli kerran äiti, jolla oli kaksi poikaa sodassa. Aina sydäntalven
taisteluun saakka oli hänen sydämensä yhtälailla vapissut ja toivonut
molempain tähden, mutta saatuaan ensimäiset tiedot taistelusta,
tapahtui hänessä muutos. Jokin ääni sanoi hänelle: "poikasi on
kuollut." "Minulla on kaksi poikaa", hän vastasi selvälle, armottomalle
äänelle, — "vanhempi ja nuorempi, — kumpiko?" Mutta vastausta ei
kuulunut, — hänen aivoissaan oli vaan yksi ainoa, pimeä ajatus, ja
hänen sielussaan oli hiljaista.
"Entä nuorempi?"
"Rakas poikani, minä olen varma siitä, että Sinä nyt joka
päivä voit puhua Jumalan kanssa niinkuin hyvän ystävän,
melkein niinkuin vertaisen. Ja jos nyt Jumala sattuu
kysymään, kuinka Sinun vanhan äitisi laita on, niin sano
hänelle, että hän toivoisi itselleen kevyitä kenkiä. Jumala
ymmärtää kyllä, mitä minä tarkoitan."
Kun äiti näin pitkälle oli joutunut, luki hän kirjeen läpi ja tunsi iloa
siitä, että niin oli voinut irtautua kaikesta maallisesta.
Oli toinen äiti, joka heti suuren taistelun jälkeen sai rykmentin
päälliköltä sanoman poikansa kuolemasta. Se oli hyvin tavallinen ja
hyvin virallinen sähkösanoma, se alkoi kuten kaikki sellaiset viestit,
jotka väliäpitämätön vieras lähettää: "surullinen velvollisuuteni on
ilmoittaa", ja niin edespäin. Tätä sähkösanomaa ei seurannut mikään
kirje. Äiti odotti kauan lähempiä tietoja, mutta herkesi vihdoin,
ajatellen, että pojan lähimmät sotatoverit olivat itsekin kaatuneet.
Mitä oli tehty hänen pojastaan? Ketä hän suri, tiesikö hän sitä
itsekään, tunsiko miestä, joka oli kaatunut? Kymmenen pitkää
sotakuukautta, — mitä oli niitten kuluessa tapahtunut hänen
poikansa sielussa? Eikö hänellä ollut vanhuksen kokemus ennen
kuolemaansa, — eikö hän ollut juonut yhdellä siemauksella elämän
pohjasakkaa? Hän kysyi kysymästä päästyään. Pojan kirjeet, joita
hän oli ennen lukenut ajattelemattomasti ja kevyesti, kuten muitakin
sota-uutisia, tuntuivat hänestä äkkiä käsittämättömiltä ja julmilta:
"eilen teimme tiedusteluretken, — kadotimme vaan kolme miestä."
Sana "vaan" sai hänet vapisemaan. "Äskeinen mieshukkamme
kukkulaa valloittaessa oli kaksi tuhatta miestä." Ei sanaakaan lisäksi,
— ei yhtä säälin sanaa kaatuneitten muistoksi.
Eräänä päivänä tuli hänen luokseen sotilas, jolta toinen käsi oli
katkaistu.
Äiti istui yhä vaiti. Hän luuli koko ajan huutavansa, mutta ääntä ei
kuulunut, hänen sisällään huusi, huusi joku: en tahdo, en tahdo, se
ei ole minun poikani, — antakaa minulle takaisin minun poikani…
"Hän piti siitä pikku elävästä. Iltaa ennen taistelua hän tuli hyvin
surulliseksi ja sanoi minulle: huomenna on minun vuoroni. Sitten hän
otti pyssynsä, meni pikku aasin luo, raaputti sitä korvan taakse ja
sanoi: mitäpä sinäkään suotta jäät kärsimään, nälkää saat nähdä ja
piiskaa maistaa, kun minua ei ole, — ja ampui."
"Oliko teillä siitä niin hyvä mieli?" kysyi sotilas yhä enemmän
ihmeissään.
Mutta äiti ei vastannut, vaan itki ensi kertaa pitkien aikojen päästä
kevyestä sydämestä.
SALAKULJETTAJA.
testbankpack.com