Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 1 . ( Using C + + ) Use the composition technique to write a class declaration and main ( ) for the following
Task Using C Use the composition technique to write a class declaration and main for the following scenarios: Create a class called Book. The Book class has the following attributes: bookld int title string author string price double bookCount static int Methods: bookId is automatically assigned by the system, starting from and increasing by The title, author and price attributes are accepted from main as parameters when the object is created. Constructor showBook function displays bookId, title, author, and price on the screen. Create a class called Order. The Order class has the following attributes: orderId int quantity int book Book Methods: All order data members accept data from main as parameters when the object is created. Constructor Write a calculateTotal function that calculates and returns the total price of the order according to the formula: totalPrice quantity book.price How can you access the private member of another class? showOrder function displays order ID book information, quantity, and total price to the screen. Create a class called Customer. The Customer class has the following attributes: customerld int customerName string phoneNo string placedOrder Order Methods: All customer data members accept data from main as parameters when the object is created. Constructor showCustomer function displays customer ID customer name, phone number, placed order information to the screen. Main Write a program that calculates and prints all information of a customer to the screen with the following format:
Task Using C
Use the composition technique to write a class declaration and main for the following scenarios:
Create a class called Book. The Book class has the following attributes:
bookld int
title string
author string
price double
bookCount static int
Methods:
bookId is automatically assigned by the system, starting from and increasing by The title, author and price attributes are accepted from main as parameters when the object is created. Constructor
showBook function displays bookId, title, author, and price on the screen.
Create a class called Order. The Order class has the following attributes:
orderId int
quantity int
book Book
Methods:
All order data members accept data from main as parameters when the object is created. Constructor
Write a calculateTotal function that calculates and returns the total price of the order according to the formula:
totalPrice quantity book.price
How can you access the private member of another class?
showOrder function displays order ID book information, quantity, and total price to the screen.
Create a class called Customer. The Customer class has the following attributes:
customerld int
customerName string
phoneNo string
placedOrder Order
Methods:
All customer data members accept data from main as parameters when the object is created. Constructor
showCustomer function displays customer ID customer name, phone number, placed order information to the screen.
Main
Write a program that calculates and prints all information of a customer to the screen with the following format:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started