Question

Trying to figure out how to complete my fourth case 4 (option exit), write a function...

Trying to figure out how to complete my fourth case 4 (option exit), write a function that display a “Good Bye” message and exits/log out from user’s account displaying a menu (sign in, balance, withdraw and exit..

#include<iostream>
#include <limits>
using namespace std;
void printstar(char ch , int n);
double balance1;

int main()
{
system("color A0");
cout<<"\n\t\t ========================================="<< endl;
cout<<"\t\t || VASQUEZ ATM SERVICES ||"<< endl;
cout<<"\t\t ========================================\n\n"<< endl;
int password;
int pincode ;
cout<<" USERS \n";
cout<<" [1] - CHRIS \n";
cout<<" [2] - STEPHANIE \n";
cout<<" [3] - JOHN \n";
cout<<" [4] - SAMANTHA \n";
cout<<" [5] - SARA \n";
cout<<" [6] - JAMES \n";
cout<<" [7] - Rose \n";
cout<<" [8] - Jamie \n";
cout<<" [9] - KEVIN \n\n\n";
for(int i=1;i<=10;i++)
{
if(i==2 || i==3 || i==4 || i==5 || i==6 || i==7 || i==8 || i==9 || i==10)
{
}
cout<<"ENTER USER NUMBER\n";
cin>>pincode;
system("cls");
if(pincode == 01)
{
cout<<"\n WELCOME CHRIS \n"; //First User
for (int i=0;i<3;i++)
{
cout <<"ENTER PIN:\n";
cin>>password;
double balance = 1000;
balance1=balance;
if (password==1)
{
for(int i=1;i<=10;i++)
{
double withdraw, deposit;
int option;
cout<<"\n";
if(i==1)
{
cout<<"\t\t *** VASQUEZ ATM SERVICES ***"<< endl;
}
printstar('-',80);
cout<<" MAIN SCREEN \n";
cout<<"[1] Balance \n";
cout<<"[2] Deposit \n";
cout<<"[3] Withdraw \n";
cout<<"[4] Exit \n";
cout<<"\n";
cout<<"Enter Option:";
cin>>option;
switch(option)
{
case 1:
cout<<"\n ************BALANCE INQUIRY************ \n";
cout<<"\n Current Balance: "<< balance1<< endl;

//low balance warning
if (balance1 < 100){
   cout << "************ LOW BALANCE! ************" << endl;
   }
continue;

case 2:
cout<<"\n ************DEPOSIT INQUIRY************ \n";
cout<<"Enter deposit amount: ";
cin>>deposit;
  
while(deposit < 0)
{
cout << "Invalid entry! \nEnter deposit amount: " ;
cin >> deposit;
}

if (deposit >= 0 ){
balance1=balance1+deposit;
cout << "New Balance: "<< balance1 << endl;
}
else{
cout << "Insuffient funds!";
}
continue;
case 3:
cout<<"\n ************WITHDRAW INQUIRY************ \n";
cout<<"Amount to Withdraw: ";
cin>>withdraw;
  
while(withdraw < 0)
{
cout << "Invalid entry! \nEnter amount to withdraw: " ;
cin >> withdraw;
}

if (balance1 >= withdraw ){
balance1 -= withdraw ;
if(balance1 < 100)
cout << "Low Balance" << endl ;
cout << "New Balance: "<< balance1 << endl;
}
else{
cout << "Insuffient funds!";
}
continue;

case 4:
cout<<"\n***[[[% EXIT MODE %]]]***\n";
system("cls");
break;
default:
cout<<"\n Invalid option. Please enter correct option: \n";
continue;
}
break;
}
break;
}
else if(i==2)
{
cout<<"\nCard is captured\n";
}
else
cout<<"Pls try again!!!\n";
}}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the solution to your question. I tried my best to solve your doubt, however, if you find it is not as good as expected by you. Please do write your further doubts regarding this question in the comment section, I will try to resolve your doubts regarding the submitted solution as soon as possible.

Please give proper indentation as shown in the screenshot

If you think, the solution provided by me is helpful to you please do an upvote.

Your question is either incomplete or you missed to upload some files. As your program has already implemented Exit (4th option), I don't know what to implement else for EXIT so please do clarify your question in the comments.

As you asked for a function to print "Good Bye", I have implemented goodbye() in this version of your program please check it.

1. #include<iostream> 2. 3. #include <limits 4. 5. using namespace std; 6. void printstar(char ch, int n); 7. 8. // function
#include<iostream>

#include <limits>

using namespace std;
void printstar(char ch, int n);

// function implementations
void printstar(char ch, int n)
{

}
void goodbye()
{
    cout<<"\nGood Bye\n";
}
double balance1;

int main() 
{
    system("color A0");
    cout << "\n\t\t =========================================" << endl;
    cout << "\t\t || VASQUEZ ATM SERVICES ||" << endl;
    cout << "\t\t ========================================\n\n" << endl;
    int password;
    int pincode;
    cout << " USERS \n";
    cout << " [1] - CHRIS \n";
    cout << " [2] - STEPHANIE \n";
    cout << " [3] - JOHN \n";
    cout << " [4] - SAMANTHA \n";
    cout << " [5] - SARA \n";
    cout << " [6] - JAMES \n";
    cout << " [7] - Rose \n";
    cout << " [8] - Jamie \n";
    cout << " [9] - KEVIN \n\n\n";
    for (int i = 1; i <= 10; i++) 
    {
      if (i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10) 
      {
          
      }
      cout << "ENTER USER NUMBER\n";
      cin >> pincode;
      system("cls");
      if (pincode == 01) 
      {
        cout << "\n WELCOME CHRIS \n"; //First User
        for (int i = 0; i < 3; i++) 
        {
          cout << "ENTER PIN:\n";
          cin >> password;
          double balance = 1000;
          balance1 = balance;
          if (password == 1) 
          {
            for (int i = 1; i <= 10; i++) 
            {
              double withdraw, deposit;
              int option;
              cout << "\n";
              if (i == 1) 
              {
                cout << "\t\t *** VASQUEZ ATM SERVICES ***" << endl;
              }
              printstar('-', 80);
              cout << " MAIN SCREEN \n";
              cout << "[1] Balance \n";
              cout << "[2] Deposit \n";
              cout << "[3] Withdraw \n";
              cout << "[4] Exit \n";
              cout << "\n";
              cout << "Enter Option:";
              cin >> option;
              switch (option) 
              {
              case 1:
                cout << "\n ************BALANCE INQUIRY************ \n";
                cout << "\n Current Balance: " << balance1 << endl;

                //low balance warning
                if (balance1 < 100)
                {
                  cout << "************ LOW BALANCE! ************" << endl;
                }
                continue;

              case 2:
                cout << "\n ************DEPOSIT INQUIRY************ \n";
                cout << "Enter deposit amount: ";
                cin >> deposit;

                while (deposit < 0) 
                {
                  cout << "Invalid entry! \nEnter deposit amount: ";
                  cin >> deposit;
                }

                if (deposit >= 0) 
                {
                  balance1 = balance1 + deposit;
                  cout << "New Balance: " << balance1 << endl;
                } 
                else 
                {
                  cout << "Insuffient funds!";
                }
                continue;
              case 3:
                cout << "\n ************WITHDRAW INQUIRY************ \n";
                cout << "Amount to Withdraw: ";
                cin >> withdraw;

                while (withdraw < 0) 
                {
                  cout << "Invalid entry! \nEnter amount to withdraw: ";
                  cin >> withdraw;
                }

                if (balance1 >= withdraw) 
                {
                  balance1 -= withdraw;
                  if (balance1 < 100)
                    cout << "Low Balance" << endl;
                  cout << "New Balance: " << balance1 << endl;
                } 
                else 
                {
                  cout << "Insuffient funds!";
                }
                continue;

              case 4:
                cout << "\n***[[[% EXIT MODE %]]]***\n";
                system("cls");
                break;
              default:
                cout << "\n Invalid option. Please enter correct option: \n";
                continue;
              }
              break;
            }
            break;
          } 
          else if (i == 2) 
          {
            cout << "\nCard is captured\n";
          } 
          else
            cout << "Pls try again!!!\n";
        }
      }
    }
    goodbye();
}
Add a comment
Know the answer?
Add Answer to:
Trying to figure out how to complete my fourth case 4 (option exit), write a function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello i am having a bit of trouble with a verified exit for my program. For...

    Hello i am having a bit of trouble with a verified exit for my program. For some reason when trying to exit it loops to the team selection function? C++ Visual Studio 2017 #include "cPlayer.h" char chChoice1 = ' '; char chChoice3 = ' '; cPlayer::cPlayer() { } cPlayer::~cPlayer() { } void cPlayer::fMenu() {    char chChoice3 = ' ';    do    {        cout << "\n\t--Menu--" << endl;        cout << "1) Enter Player Name" <<...

  • Hey, so i am trying to have my program read a text file using a structure...

    Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...

  • I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for.....

    I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for..while..do while,loops,pointer,address,continue,return,break. Create a C++ program which contain a function to ask user to enter user ID and password. The passwordmust contain at least 6 alphanumeric characters, 1 of the symbols !.@,#,$,%,^,&,* and 1 capital letter.The maximum allowable password is 20. Save the information. Test the program by entering the User ID and password. The...

  • fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string>...

    fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct book { int ISBN; string Author; string Title; string publisher; int Quantity; double price; }; void choice1(book books[], int& size, int MAX_SIZE) { ifstream inFile; inFile.open("inventory.txt"); if (inFile.fail()) cout <<"file could not open"<<endl; string str;    while(inFile && size < MAX_SIZE) { getline(inFile, str); books[size].ISBN = atoi(str.c_str()); getline(inFile, books[size].Title);    getline(inFile, books[size].Author); getline(inFile, books[size].publisher);          getline(inFile,...

  • c++ programming : everything is done, except when you enter ("a" ) in "F" option ,...

    c++ programming : everything is done, except when you enter ("a" ) in "F" option , it does not work. here is the program. #include <iostream> #include <string> #include <bits/stdc++.h> #include <iomanip> #include <fstream> using namespace std; #define MAX 1000 class Inventory { private: long itemId; string itemName; int numberOfItems; double buyingPrice; double sellingPrice; double storageFees; public: void setItemId(long id) { itemId = id; } long getItemId() { return itemId; } void setItemName(string name) { itemName = name; } string...

  • I am trying to run this program in Visual Studio 2017. I keep getting this build...

    I am trying to run this program in Visual Studio 2017. I keep getting this build error: error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 1>Done building project "ConsoleApplication2.vcxproj" -- FAILED. #include <iostream> #include<cstdlib> #include<fstream> #include<string> using namespace std; void showChoices() { cout << "\nMAIN MENU" << endl; cout << "1: Addition...

  • My if/else statement wont run the program that I am calling. The menu prints but once...

    My if/else statement wont run the program that I am calling. The menu prints but once I select a number the menu just reprints, the function called wont run. What can I do to fix this probelm? #include <iostream> #include "miltime.h" #include "time.h" #include "productionworker.h" #include "employee.h" #include "numdays.h" #include "circle.h" using namespace std; int main() { int select=1;     while (select>0) { cout << "Option 1:Circle Class\n"<< endl; cout << "Option 2:NumDay Class\n" << endl; cout <<"Option 3:Employee and Production...

  • Program is in C++, program is called airplane reservation. It is suppose to display a screen...

    Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...

  • (Coding done in c++, Virtual Studio) Having a problem with the line trying to compare the...

    (Coding done in c++, Virtual Studio) Having a problem with the line trying to compare the date of birth.            **fall.sort(compare_DOB); //Here lies your error** #include <fstream> #include <iostream> #include <string> #include <list> #include <cctype> using namespace std; const char THIS_TERM[] = "fall.txt"; const string HEADER = "\nWhat do you want to do ?\n\n" "\t. Add a new friend name and DOB ? \n" "\t. Edit/Erase a friend record ? \n" "\t. Sort a Friend's record ? \n"...

  • Have Corporate Sales for 6 divisions and their quarterly sales figures. The issue is the error...

    Have Corporate Sales for 6 divisions and their quarterly sales figures. The issue is the error function where I am unable to have user reinput the same quarterly amount without going to the next quarter input. This has affected the total sales for the company. /***************************************** This program gathers sales information for six divisions and displays the total sales for each division and total company. *****************************************/ #include<iostream> using namespace std; // Classs division sales class DivSales { private: // Variables...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT