Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
C++
tArea/ContentArea.aspx?LocationID=48351&LocationType=1&ElementID=2112585
BAU
BAUGO
BAU Library
Calendar Support
Status and follow-up
Participants
More -
Plans
Resources
iented P...
Overview
Assignment
Write a program that calculates the heaviness of a book trilogy composed of three books. For each book, the user will give the page count, header
page count, total word count and picture count all as integers.
Based on this information the program should calculate the average word density of this book trilogy as well as its overall heaviness. Finally, the
program should print out the average word density of the trilogy as a double and overall heaviness as a string.
The word density of a book is calculated as first finding the useful page count as subtracting the header page count from the total page count,
subtracting 0.5 for each picture. Then, the word density is calculated by dividing the total word count by the useful page count.
To find the heaviness of a book, first the ratio between the page count and the picture count is checked. If it is less than 40, then the heaviness of
the book is "cartoonish". If not, then the word density is checked against 100. It the word density is bigger than 100, then the book is "heavy",
otherwise the book is "light".
The overall heaviness of the trilogy is the heaviness of the lightest of the three books (i.e., "cartoonish" is the lightest, then "light", then "heavy").
Requirements:
• All book related information should be kept as private inside a class.
• Class should take all related input in its constructor function.
• Book word density calculation should be done in a function of the class.
• Book heaviness evaluationshould be done in a function of the class.
NOTE: The number of pictures could be 0, In this case, the heaviness CANNOT be "cartoonish".
400 8 13000 4
100 1 100 0
500 12 150000 2
200 3 6000 12
Input
100 1 100 0
670 21 340000 7
1000 25 38000
100 1 100 0
1020 48 950000 0
10
34,6407
Output
1.0101 light
604.033 heavy
cartoonish
Answer assignment
O
52
A
FS
F6
X]
FB
F9
F10
&
Transcribed Image Text:tArea/ContentArea.aspx?LocationID=48351&LocationType=1&ElementID=2112585 BAU BAUGO BAU Library Calendar Support Status and follow-up Participants More - Plans Resources iented P... Overview Assignment Write a program that calculates the heaviness of a book trilogy composed of three books. For each book, the user will give the page count, header page count, total word count and picture count all as integers. Based on this information the program should calculate the average word density of this book trilogy as well as its overall heaviness. Finally, the program should print out the average word density of the trilogy as a double and overall heaviness as a string. The word density of a book is calculated as first finding the useful page count as subtracting the header page count from the total page count, subtracting 0.5 for each picture. Then, the word density is calculated by dividing the total word count by the useful page count. To find the heaviness of a book, first the ratio between the page count and the picture count is checked. If it is less than 40, then the heaviness of the book is "cartoonish". If not, then the word density is checked against 100. It the word density is bigger than 100, then the book is "heavy", otherwise the book is "light". The overall heaviness of the trilogy is the heaviness of the lightest of the three books (i.e., "cartoonish" is the lightest, then "light", then "heavy"). Requirements: • All book related information should be kept as private inside a class. • Class should take all related input in its constructor function. • Book word density calculation should be done in a function of the class. • Book heaviness evaluationshould be done in a function of the class. NOTE: The number of pictures could be 0, In this case, the heaviness CANNOT be "cartoonish". 400 8 13000 4 100 1 100 0 500 12 150000 2 200 3 6000 12 Input 100 1 100 0 670 21 340000 7 1000 25 38000 100 1 100 0 1020 48 950000 0 10 34,6407 Output 1.0101 light 604.033 heavy cartoonish Answer assignment O 52 A FS F6 X] FB F9 F10 &
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education