Write a C++ program.

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

Write a C++ program.

Write a complete program based on the following requirements:
Use the following structure.
struct Rental
{
char name [20];
float rent;
int month;
} ;
Declare and define function report..):
Parameter
: array R of struct Rental [size 3]
Function prototype given : float report(struct Rental[]);
Using a for loop, display on the screen the records of tenants that has rental due more
than $1000. Also calculate the total amount due for these tenants. [Note: refer to
sample output screen]
Return the total amount due.
In main( ),
Declare an array R of struct Rental. Array size is 3. You may use the code below that has
hardcoded values for it.
struct Rental R[3] = {{"Megan", 300, 4},{"Johnson", 250, 1},{"David", 790, 2}};
Call function report(..):
Parameter : array R of struct Rental.
The function will return the grand total.
Display the grand total amount that is due.
Transcribed Image Text:Write a complete program based on the following requirements: Use the following structure. struct Rental { char name [20]; float rent; int month; } ; Declare and define function report..): Parameter : array R of struct Rental [size 3] Function prototype given : float report(struct Rental[]); Using a for loop, display on the screen the records of tenants that has rental due more than $1000. Also calculate the total amount due for these tenants. [Note: refer to sample output screen] Return the total amount due. In main( ), Declare an array R of struct Rental. Array size is 3. You may use the code below that has hardcoded values for it. struct Rental R[3] = {{"Megan", 300, 4},{"Johnson", 250, 1},{"David", 790, 2}}; Call function report(..): Parameter : array R of struct Rental. The function will return the grand total. Display the grand total amount that is due.
Sample Output Screen
AMOUNT DUE MORE THAN $1000.00
Tenant name : Megan
Monthly rental : $ 300.00
Unpaid months :$ 4
Unpaid amount :$ 1200.00
Tenant name : David
Monthly rental : $ 790.00
Unpaid months :$ 2
Unpaid amount : $ 1580.00
Total rental to be collected : $ 2780.00
Transcribed Image Text:Sample Output Screen AMOUNT DUE MORE THAN $1000.00 Tenant name : Megan Monthly rental : $ 300.00 Unpaid months :$ 4 Unpaid amount :$ 1200.00 Tenant name : David Monthly rental : $ 790.00 Unpaid months :$ 2 Unpaid amount : $ 1580.00 Total rental to be collected : $ 2780.00
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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