//******************************************************************* // // Program: MacroSoft // // Author: CS 1711, Section B // // Description: This will be the wrapper for MacroSoft functions // // Date: 1999 Fall // // Course Information: CS 1711, Section B // // Filename: menu.cpp // //******************************************************************* // declares the input/output operations #include // inclusion of classes #include "employee.h" #include "computer.h" #include "product.h" void clrscr(); int writemenu(); // function to update Employee salary void salaryUpdate(Employee currentEmployee); // A menu we'll expand... void main() { int choice, newRam; Employee emp1("12345", 10000, 11, 5, 1999); Computer myComputer; // call default constructor Computer niceComputer("12345", "PIII", 128); Product theProduct("56789", 300.0); clrscr(); cout << "Welcome to Macrosoft..." << endl; do { choice = writemenu(); //initialize the user's choice switch (choice) { case 1 : salaryUpdate(emp1); break; case 2 : { cout << "How much memory?"; cin >> newRam; myComputer.memUpgrade(newRam); }; break; case 3 : theProduct.writeProdInfo(); break; case 0 : cout << endl << "Exiting menu..."; break; default : cout << "invalid selection, try again"; } //end switch(choice) } while (choice != 0); //end do-while (choice) clrscr(); cout << "Thank you for using the Macrosoft system" << endl << endl; } int writemenu() { int choice; int count = 0; while (count < 2) { cout << endl; count++; } cout << "At the prompt input:" << endl << endl; cout << " 1 to update a salary." << endl; cout << " 2 to upgrade ram." << endl; cout << " 3 to write product info." << endl; cout << endl << endl << " 0 to exit." << endl; while (count < 11) { cout << endl; count++; }; cout << endl << endl << "Enter a menu selection>" << endl << endl; cin >> choice; return choice; } void clrscr() { int lines = 25; for(int i = 0; i < 25; i++) cout << endl; }; void salaryUpdate(Employee currentEmployee) { double change, // keyboard input newSalary; // result of change cout << "The current salary is $" << currentEmployee.getSalary() << endl; // get value for update cout << "Enter the change in salary:" << endl; cin >> change; // and echo it: cout << endl; cout << "The value entered for the change: $" << change << endl; // updates the current employee data newSalary = currentEmployee.getSalary() + change; currentEmployee.setSalary(newSalary); // the complete new information: cout << endl; cout << "Current employee information:" << endl <