Question

In C++ write a simple menu program that displays a menu for the user in an...

In C++ write a simple menu program that displays a menu for the user in an object-oriented technique. The menu should keep showing up until the user chooses to quit. Also, there is a sub-menu inside a menu. The user should get at least a line displayed after he or she chooses that particular option meaning if the user presses 1 for the read actors from the file. The output can look like "reading actors from a file" and then display two other options a and b inside it, similar for sub menus aswell. Some of it has a menu inside a sub-menu as well. Need to submit one .h file with class and other .cpp files with implementation. The user interference will look like this.

  1. Read Records from File

    1. Read Actors

    2. Read Movies

  2. Add a Record

    1. Add an Actor

    2. Add a Movie

  3. Modify a Record

    1. Modify an Actor

      1. Search for Record to Modify by Name

        1. Modify Selected Record

          1. Fields to Modify

          2. Done

        2. Delete Selected Record

        3. Cancel

    2. Modify a Movie

      1. Search for Record to Modify by Name

        1. Modify Selected Record

          1. Fields to Modify

          2. Done

        2. Delete Selected Record

        3. Cancel

  4. Sort Records

    1. Sort Actors

      1. Categories to Sort

    2. Sort Movies

      1. Categories to Sort

  5. Search

    1. Search Actors

      1. Search Categories

        1. Secondary Search (Narrow Results)

        2. Done

    2. Search Movies

      1. Search Categories

        1. Secondary Search (Narrow Results)

        2. Done

  6. Write Record to File

    1. Write Actors to a File

    2. Write Movies to a File

  7. Quit

Feel free to ask and clarify if you have any doubts.

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

menu.cpp

#include <bits/stdc++.h>
using namespace std;

// Function to display the menu
void menu()
{
   cout << "\n1.Read Records from File\n";
   cout << "2.Add a Record\n";
   cout << "3.Modify a Record\n";
   cout << "4.Sort Records\n";
   cout << "5.Search\n";
   cout << "6.Write Record to File\n";
   cout << "7.QUIT\n";
}

int main()
{
int choice,f;
int c;
while(1)
{
   menu();
   cout << "\nEnter your choice:\n";
   cin>>choice;
   switch (choice)
{
   case 1:
{
f=0;
while(1)
{
cout << "\n1.Read Actors\n";
cout << "2.Read Movies\n";
cout << "3.go to main menu\n" ;
cout << "choose option:";
cin>>c;
       switch(c)
{
           case 1:{
cout << "\nreading actors from a file\n\n";
           break;
}
case 2:{
cout << "\nreading movies from a file\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
          
}
        if(f==1)
            break;

}

       break;
   }
   case 2:
{
f=0;
while(1)
{
       cout << "\n1.Add an Actor\n";
       cout << "2.Add a Movie\n";
       cout << "3.go to main menu\n" ;
  cout << "choose option:";
       cin>>c;
       switch(c)
{
           case 1:{
cout << "\nan actor is added to the file\n\n";
           break;
}
case 2:{
cout << "\na movie is added to the file\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
}

       if(f==1)
            break;  
}
       break;
   }
   case 3:
{
f=0;
while(1)
{
       cout << "\n1.Modify an Actor\n";
       cout << "2.Modify a Movie\n";
       cout << "3.go to main menu\n" ;
cout << "choose option:";
       cin>>c;
       switch(c)
       {
           case 1:{
cout << "\nan actor is modified\n\n";
           break;
}
case 2:{
cout << "\na movie is modified\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
}

       if(f==1)
            break;  
}
       break;
         
   }
   case 4:
{
f=0;
while(1)
   {
       cout << "\n1.Sort Actors\n";
       cout << "2.Sort Movies\n";
       cout << "3.go to main menu\n" ;
  cout << "choose option:";
       cin>>c;
       switch(c)
       {
           case 1:{
cout << "\nActors are Sorted according to categories\n\n";
           break;
}
case 2:{
cout << "\nMovies are Sorted according to categories\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
}

       if(f==1)
            break;  
}
       break;
      
   }
   case 5:
   {
f=0;
while(1)
   {
       cout << "\n1.Search Actors\n";
       cout << "2.Search Movies\n";
      cout << "3.go to main menu\n" ;
cout << "choose option:";
       cin>>c;
       switch(c)
       {
           case 1:{
cout << "\nsearch results (Search Categories)\n\n";
           break;
}
case 2:{
cout << "\nsearch results (Search Categories)\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
          
}
        if(f==1)
            break;

}

       break;
      
   }
   case 6: {
       f=0;
while(1)
   {
       cout << "\n1.Write Actors to a File\n";
       cout << "2.Write Movies to a File\n";
      cout << "3.go to main menu\n" ;
  cout << "choose option:";
       cin>>c;
       switch(c)
{
           case 1:{
cout << "\nactors written into the file\n\n";
           break;
}
case 2:{
cout << "\nmovies written into the file\n\n";
           break;
}
           case 3:{
           f=1;
           break;
           }
          
}
        if(f==1)
            break;

}

       break;   
         
   }
   case 7:
   {
       exit(0);
       break;
   }
   default:
       printf("Wrong Input\n");
   }
}

   return 0;
}

output:

divya@divya-Inspiron-14-3467:-$ ./a.out 1.Read Records from File 2. Add a Record 3. Modify a Record 4.Sort Records 5. Search

Add a comment
Know the answer?
Add Answer to:
In C++ write a simple menu program that displays a menu for the user in an...
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++ Write a C++ program that user is able to choose the function of their wanting from this menu : Users will be asked...

    C++ Write a C++ program that user is able to choose the function of their wanting from this menu : Users will be asked to enter the movies they like along with the Genre and one Actor/Actress per movie. the entering process should look like this: Note that if the user enters yes, the program should start entering the next movie with its properties. Available movies must be entered as follow: The program should enter as many available movies as...

  • Write a complete C++ program that will: Declare a vector of integers Use a pointer to...

    Write a complete C++ program that will: Declare a vector of integers Use a pointer to dynamically allocate an array of 10 elements Ask the user how many values they would like to have in the data structures Read in the user’s response and make sure that it is greater than 20 (error loop) Generate the number of integers that the user asked for and store them into both data structures. The integer values should be unique unordered values (no...

  • Write a program that displays a menu on the screen. The menu will give the user...

    Write a program that displays a menu on the screen. The menu will give the user four options - enter two integers, enter two decimal numbers (#.#), enter one integer and one decimal number, or quit. The inputs should be labelled a, b, c, or d, and you should enter in the letter to choose the appropriate option. Once the user selects the option, two numbers will be read in from the user. The numbers will be added together and...

  • Write a contacts database program that presents the user with a menu that allows the user...

    Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • C++ program Write a C++ program to manage a hospital system, the system mainly uses file...

    C++ program Write a C++ program to manage a hospital system, the system mainly uses file handling to perform basic operations like how to add, edit, search, and delete record. Write the following functions: 1. hospital_menu: This function will display the following menu and prompt the user to enter her/his option. The system will keep showing the menu repeatedly until the user selects option 'e' from the menu. Arkansas Children Hospital a. Add new patient record b. Search record c....

  • Serve the user in two phases: In C++ Phase A: (1) Read all input records one...

    Serve the user in two phases: In C++ Phase A: (1) Read all input records one by one into arrays in main memory. (2) Display all the records on the screen in the order they are read from the input data file. (3) Do a Selection Sort (must be implemented as a function) to sort the records in ascending order on STUDENT_ID and display all the full records correctly in the correct order after sorting. Phase B: (1) Then, the...

  • This homework problem has me pulling my hair out. We are working with text files in Java using Ne...

    This homework problem has me pulling my hair out. We are working with text files in Java using NetBeans GUI application. We're suppose to make a movie list and be able to pull up movies already in the text file (which I can do) and also be able to add and delete movies to and from the file (which is what I'm having trouble with). I've attached the specifications and the movie list if you need it. Any help would...

  • Assignment Write a menu-driven C++ program to manage a class roster of student names that can...

    Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...

  • Write a menu-driven C++ program to manage a class roster of student names that can grow...

    Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students Q...

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