Question

C++ Programming: Customer file Can same one help me out with a example finsih and working...

C++ Programming: Customer file

Can same one help me out with a example finsih and working programm ?

Program a simple customer file. Each customer should be defined as a class customer can be modelled with the following attributes: Last name, first name, unique Customer number, postcode, place of residence. Implement the following menu for this:
(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Comments:
- At point (e) the unique customer number should be assigned automatically.
- At point (l) a number x is read in first. Customer no. x is then deleted. Make sure that only customers that exist are deleted (checking the valid range). There are many different Possible solutions. It is therefore essential that you leave a short comment, that describes how your solution works.

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

Please let me know if u need more info:-

=============

#include <iostream>

#include <list>

#include <iterator>

#include <string>

using namespace std;

class Customer {

public :

string firstName;

string lastName;

int custNumber;

int postcode;

string city;

bool operator == (const Customer& c) const { return custNumber == c.custNumber; }

bool operator != (const Customer& c) const { return !operator==(c); }

};

void printMenu(){

cout<<"(e) Enter a new customer from Keypad"<<endl;

cout<<"(l) Deleting a customer"<<endl;

cout<<"(a) Output of all customers"<<endl;

cout<<"(x) Exit"<<endl;

cout<<"Your choice: ";

}

int main() {

list <Customer> customers;

while(1){

char choice;

printMenu();

cin>>choice;

if(choice == 'e' || choice == 'E'){

Customer customer;

customer.custNumber = customers.size() + 1;

cout<<"Enter first name: ";

cin>>customer.firstName;

cout<<"Enter last name: ";

cin>>customer.lastName;

cout<<"Enter post code: ";

cin>>customer.postcode;

cout<<"Enter place of residence: ";

cin>>customer.city;

customers.push_back(customer);

}else if(choice == 'l' || choice == 'L'){

int custNum = 0;

cout<<"Enter customer number: ";

cin>>custNum;

list <Customer> :: iterator it = customers.begin();

while (it != customers.end()) {

if(it->custNumber == custNum){

it = customers.erase(it);

} else{

it++;

}

}

}else if(choice == 'a' || choice == 'A'){

list <Customer> :: iterator it;

for(it = customers.begin(); it != customers.end(); ++it) {

cout<<"Customer Number: " << it->custNumber <<endl;

cout<<"Customer First Name: " << it->firstName <<endl;

cout<<"Customer Last Name: " << it->lastName <<endl;

cout<<"Customer post code: " << it->postcode <<endl;

cout<<"Customer place of residence.: " << it->city <<endl;

cout<<"============================================= " << endl;

}

}

else if(choice == 'x' || choice == 'X'){

break;

}else{

cout<<"Enter Proper choice"<<endl;

}

}

}

=======================

OUTPUT:-

==============

(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Your choice: e
Enter first name: s
Enter last name: d
Enter post code: 2
Enter place of residence: e
(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Your choice: a
Customer Number: 1
Customer First Name: s
Customer Last Name: d
Customer post code: 2
Customer place of residence.: e
=============================================
(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Your choice: l
Enter customer number: 1
(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Your choice: a
(e) Enter a new customer from Keypad
(l) Deleting a customer
(a) Output of all customers
(x) Exit
Your choice: x

==

==

==

Thanks

Add a comment
Know the answer?
Add Answer to:
C++ Programming: Customer file Can same one help me out with a example finsih and working...
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
  • C++ programming: Card game Can same one help me out with a example finsih and working...

    C++ programming: Card game Can same one help me out with a example finsih and working programm ? Program the basis for a card game (as a class card game): ● A card is represented by its suit/symbol (clubs, spades, hearts, diamonds) and a value (seven, eight, nine, ten, jack, queen, king, ace). ● A deck of cards consists of a pile of 32 cards that are completely connected to four players are distributed. ● Implement the following menu: ===...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Programming Assignment 5: UML Diagram Objectives: After successfully completing this assignment, students will practice Object Oriented...

    Programming Assignment 5: UML Diagram Objectives: After successfully completing this assignment, students will practice Object Oriented design by creating an UML diagram for a Java program. Program Statement: Bank System You were asked to create a simple UML diagram for a bank system. Each bank has a specific identification number, a name, and a location that needs to be stored. Tellers serve customers’ loans, checking and savings accounts. The bank must know each tellers’ name and identification number for record...

  • SAS programming . Can someone help me on report 2 it’s not working and I do...

    SAS programming . Can someone help me on report 2 it’s not working and I do not know if I’m doing it right. 12.14.4.4. 2.1.2. 3.4.2 3 2 5 2 5 1 5 1 3 5 5 2 5 4 1 1 5.5 3.5.5.3.5-53-3-1, 1,3-3.12 334 3423 53533.22125253142 1 545 322142433 13451551 54514 5.4.1 4.3.3.1 5.22 201 201 009 210 201 202 013 004 005 006 997 300 009 400 400 004 ons dos 100 102 103 104 105 006...

  • Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you....

    Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you. Phase 1 You must design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms.    Algorithm descriptions: Given an integer parameter named current_number and two constant global variables: const int MIN_NUMBER = 1; const int MAX_NUMBER = 8; Create an algorithm named forward, that will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In...

  • Piggy back on the programming project one you completed in module 3. You will use some...

    Piggy back on the programming project one you completed in module 3. You will use some of those concepts here again. We will be building this project inside out, start individual quiz and use a for loop to repeat it three times for three students. In this program you will be required to write a python program that generates math quizzes for students in second grade. Your program should do the following Ask the student for their name Provide 3...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year...

    JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year of storm/ Name of storm/ mmdd storm started/ mmdd storm ended/ magnitude of storm/ //made up data 2004/Ali/1212/1219/1 2003/Bob/1123/1222/3 1980/Sarah/0123/0312/0 1956/Michael/1211/1223/4 1988/Ryan/0926/1019/ 1976/Tim/0318/1010/0 2006/Ronald/0919/1012/2 1996/Mona/0707/0723/1 2000/Kim/0101/0201/1 2001/Jim/1101/1201/3 Text file Class storm{ private String nameStorm; private int yearStorm; private int startStorm; private int endStorm; private int magStorm; public storm(String name, int year, int start, int end, int mag){ nameStorm = name; yearStorm = year; startStorm...

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