Given a problem and correct (shuffled) program, re-arrange the shuffled code segments in the correct order. --------------------------

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

Given a problem and correct (shuffled) program, re-arrange the shuffled code segments in the correct order.

--------------------------------------------------------------------
 
ATM machines are nowadays more in use, people are easily able to withdraw money from the ATM, instead of rushing to the bank and waiting in a long queue to get money. But there are people who don't know, how to use ATM machines and they are not aware of the money withdrawal range. Write a  c++ program to help them using the Exception handling mechanism.

Pin number should be of 4 digits, an exception should be thrown if the user enters more than 4 digits(refer to sample input and output)

The maximum amount that can be withdrawn is Rs.20000, an exception should be thrown if the user enters more than Rs.20000(refer to sample input and output.)

Consider a class named Atm with the following data members
Data type Variable name
int pin
double amount

 


The class Atm has the following constructor and method

Member Function Description
Atm(int pin,double amount) Sets the values passed by parameters.
void display() This method displays the success message.

 

Input and Output Format:

Refer sample input and output for formatting specifications

[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:

Welcome to IndusLand Bank ATM
Enter your pin number
12345
Exception: Pin number should be of 4 digit
Enter your valid pin number
1234
Enter the transaction amount
30000
Exception: Transaction amount exceeded, the limit is Rs.20000
Enter the transaction amount again
20000
Transaction successful, visit again

Sample Input and Output 2:

Welcome to IndusLand Bank ATM
Enter your pin number
4556
Enter the transaction amount
19000
Transaction successful, visit again

 

------------------ SHUFFLED PROGRAM PROVIDE IN ATTACH IMAGE KINDLY SEE . -------------------------

cout<<"Transaction successful, visit again"<<endl;
}
public:
void display()
{
#include<iostream>
#include<cmath>
#include <iomanip>
throw "Exception: Transaction amount exceeded, the limit is Rs.20000";
}
cout <<"Enter the transaction amount again"<<endl;
cin>>amount;
catch(const char* msg)
{
Atm(int pin,double amount)
{
try
{
cout <<"Enter the transaction amount"<<endl;
int pin;
double amount;
cout<<"Welcome to IndusLand Bank ATM"<<endl;
catch(const char* msg)
}
try
{
cout <<"Enter your pin number"<<endl;
throw "Exception: Pin number should be of 4 digit";
}
}
Atm a(pin,amount);
a.display();
return 0:
cin>>amount;
if(amount>20000)
{
Transcribed Image Text:cout<<"Transaction successful, visit again"<<endl; } public: void display() { #include<iostream> #include<cmath> #include <iomanip> throw "Exception: Transaction amount exceeded, the limit is Rs.20000"; } cout <<"Enter the transaction amount again"<<endl; cin>>amount; catch(const char* msg) { Atm(int pin,double amount) { try { cout <<"Enter the transaction amount"<<endl; int pin; double amount; cout<<"Welcome to IndusLand Bank ATM"<<endl; catch(const char* msg) } try { cout <<"Enter your pin number"<<endl; throw "Exception: Pin number should be of 4 digit"; } } Atm a(pin,amount); a.display(); return 0: cin>>amount; if(amount>20000) {
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
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