Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You may reuse the code from the first part of the lab assignment. You may assume

ID: 3543935 • Letter: Y

Question


You may reuse the code from the first part of the lab assignment. You may assume that in the input file, the fields are always named the same and the order of the fields is the same. However, the data fields of the file may change. That is, you may not program your assignment such that it only works with the provided example file.

Hints: Note that you can recognize words that denote the names of the fields in the database files such as last name: by comparing them to literal string constants or (simpler) you can just exploit the fixed order of the fields, read these names and immediately discard them. That is, we already know that the name would the the forth and fifth string input and the cent amount is the tenth. So you only need to process the fifth string, the tenth string and so on.

Explanation / Answer

#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip> using namespace std;

int main()
{
string date;
string name;
int checkamount_dollars;
int checkamount_centes;
string payee_name;

cout << "Enter the date of the check. Date: ";
cin >> date;

cout << " Enter the name :";
cin >> name;

cout << " What is the check amount in dollars: ";
cin >> checkamount_dollars;

cout << " What is amount in cents: ";
cin >> checkamount_centes;

cout << " Enter the payee's name. Pay to the Order of:";
cin >> payee_name;


if (checkamount_dollars >10 && checkamount_dollars <=100)
{

cout << setprecision(2) << fixed << showpoint;
cout << "==================================== ";
cout << name << date < cout << " Pay to the Order of: " << payee_name << checkamount_dollars <<"."<
if(checkamount_dollars>20)
{
switch(checkamount_dollars/10)
{
case 2: cout<<" Twenty"< break;

case 3: cout<<" Thirty"< break;

case 4: cout<<" Forty"< break;

case 5: cout<<" Fifty"< break;

case 6: cout<<" Sixty"< break;

case 7: cout<<" Seventy"< break;

case 8: cout<<" Eighty"< break;

case 9: cout<<" Nintey"< break;


}

switch(checkamount_dollars%10)
{
case 1: cout<<"one"< break;
case 2: cout<<"Two"< break;

case 3: cout<<"Three"< break;

case 4: cout<<"Four"< break;

case 5: cout<<"Five"< break;

case 6: cout<<"Six"< break;

case 7: cout<<"Seven"< break;

case 8: cout<<"Eight"< break;

case 9: cout<<"Nine"< break;


}

}

else if(checkamount_dollars>10 && checkamount_dollars<19)
{
switch(checkamount_dollars/10)
{

case 1: cout<<" Eleven"< break;
case 2: cout<<" Twelve"< break;

case 3: cout<<" Thirteen"< break;

case 4: cout<<" Fourteen"< break;

case 5: cout<<" Fifteen"< break;

case 6: cout<<" Sixteen"< break;

case 7: cout<<" Seventeen"< break;

case 8: cout<<" Eighteen"< break;

case 9: cout<<" Nineteen"< break;

}
}

cout << "and "< cout << "or Amount more than $100";
cout << "Please enter a valid amount: ";
cin >> checkamount_dollars;
}

system("pause");
}
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote