re-arrange the shuffled code segments in the correct order.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
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 . AND DON'T ADD ANY EXTRA CODE JUST RE-ARRANGE WITH PROVIDED SHUFFLED PROGRAM IN ATTACH IMAGE  -------------------------

 

#include<iostream>
#include<cmath>
#include <iomanip>
#include <cstring>
using namespace std;
class Atm {
public:
void display()
{
int pin;
double amount;
cout<<"Welcome to IndusLand Bank ATM"<<endl;
try
{
cout <<"Enter your pin number"<<endl;
}
throw "Exception: Transaction amount exceeded, the limit is Rs.20000";
}
cout<<"Transaction successful, visit again"<<endl;
};
public:
int pin;
double amount;
cout <<"Enter the transaction amount again"<<endl;
cin>>amount;
}
throw "Exception: Pin number should be of 4 digit";
}
catch(const char* msg)
cerr << msg << endl;
cin>>pin;
if(!(pin >=1000 && pin<=9999))
{
public:
Atm()
{
// Main function for the program
int main()
{
cout <<"Enter your valid pin number"<<endl:
cin>>pin;
}
}
Atm(int pin,double amount)
{
try
{
cout <<"Enter the transaction amount"<<endl;
catch(const char* msg)
cerr << msg << endl;
this->pin = pin;
this->amount = amount;
}
Atm a(pin,amount);
a.display();
return 0;
cin>>amount;
if(amount>20000)
Transcribed Image Text:#include<iostream> #include<cmath> #include <iomanip> #include <cstring> using namespace std; class Atm { public: void display() { int pin; double amount; cout<<"Welcome to IndusLand Bank ATM"<<endl; try { cout <<"Enter your pin number"<<endl; } throw "Exception: Transaction amount exceeded, the limit is Rs.20000"; } cout<<"Transaction successful, visit again"<<endl; }; public: int pin; double amount; cout <<"Enter the transaction amount again"<<endl; cin>>amount; } throw "Exception: Pin number should be of 4 digit"; } catch(const char* msg) cerr << msg << endl; cin>>pin; if(!(pin >=1000 && pin<=9999)) { public: Atm() { // Main function for the program int main() { cout <<"Enter your valid pin number"<<endl: cin>>pin; } } Atm(int pin,double amount) { try { cout <<"Enter the transaction amount"<<endl; catch(const char* msg) cerr << msg << endl; this->pin = pin; this->amount = amount; } 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
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY