Arithmetic Exception   Arman has a shop where he provides stuff on rent. The whole payment system is computerised. A customer has to enter the item name, item type, cost, and the number of days they have taken the item for rent. The system then tells them the cost per day. But there is a problem with the machine that if the number of days entered is not an integer value then the system would crash. To handle this, Arman decided to upgrade the software and use exception handling in case the customer entered any invalid input it should display " Number of days x is invalid". Write a C++ program to find the item cost per day with the cost for n days given. The arithmetic exception has to be thrown if the n is less than or equal to zero. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Item has the following private data members. Data type Variable Name string name string type double cost In the main method, get the necessary inputs and number of days from the user and display the item details, if the number of days is not less than or equal to zero. Input  and output format: Display the Item Details with cost per day with respect to two decimal places. Refer Sample input and output for formatting specifications [All text in bold corresponds to input and rest corresponds to output] Sample Input and Output 1: Enter item name: table Enter item type: furniture Enter item cost: 30000 Enter number of days: 30 Item name:table Item type:furniture Item cost per day:1000.00   Sample Input and Output 2: Enter item name: pen Enter item type: stationary Enter item cost: 2762   Enter number of days:  0 Arithmetic Exception:Number of days 0 is invalid

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
Arithmetic Exception

 

Arman has a shop where he provides stuff on rent. The whole payment system is computerised. A customer has to enter the item name, item type, cost, and the number of days they have taken the item for rent. The system then tells them the cost per day. But there is a problem with the machine that if the number of days entered is not an integer value then the system would crash. To handle this, Arman decided to upgrade the software and use exception handling in case the customer entered any invalid input it should display " Number of days x is invalid".

Write a C++ program to find the item cost per day with the cost for n days given. The arithmetic exception has to be thrown if the n is less than or equal to zero.

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

The class Item has the following private data members.

Data type Variable Name
string name
string type
double cost


In the main method, get the necessary inputs and number of days from the user and display the item details, if the number of days is not less than or equal to zero.

Input  and output format:
Display the Item Details with cost per day with respect to two decimal places.
Refer Sample input and output for formatting specifications

[All text in bold corresponds to input and rest corresponds to output]

Sample Input and Output 1:

Enter item name:
table
Enter item type:
furniture
Enter item cost:
30000
Enter number of days:
30
Item name:table
Item type:furniture
Item cost per day:1000.00

 

Sample Input and Output 2:

Enter item name:
pen
Enter item type:
stationary
Enter item cost:
2762  
Enter number of days:
 0
Arithmetic Exception:Number of days 0 is invalid
 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Random access
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.
Similar questions
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