Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Create a new file (in Dev C++) .
In Lab 2, you created a menu for a simple calculator
In Lab 6, you added some functionality based on the user selection.
In Lab 7, you added some functionality for a main program loop and input validation.
In this lab, you will create some general purpose functions to offload some of the tasks in main().
Write functions for:
- displaying "hello" message
- displaying menu
- displaying "goodbye" message
- displaying "invalid selection" message (for invalid menu selection)
- displaying "invalid input" message (for divide-by-zero input validation)
Prototypes should be written for each function
Function definitions can be in any order, after main()
Call the functions as needed in main(), replacing the original code
The program should:
- call function to display a "hello" message before presenting the menu
- call function to display the menu
- prompt user for selection
- accept either uppercase or lowercase for selection
- call function to display error message if invalid selection is made (example: E)
- display the selection back to the user
- prompt for two numbers
- perform the operation and display the results
- use loop for input validation of second number during division
- call function to display error message for division when second number is 0
- after displaying result, use loop to present menu again and ask for another selection
- do not display "hello" message again
- call function to display a "goodbye" message before exiting the program
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Create a contacts module to meet the following requirements:arrow_forwardSummary In this lab, you open a file and read input from that file in a prewritten Python program. The program should read and print the names of flowers and whether they are grown in shade or sun. The data is stored in the input file named flowers.dat. Instructions Open the source code file named Flowers.py Write a while loop to read the input until EOF is reached. In the body of the loop, print the name of each flower and where it can be grown (sun or shade). Execute the program. ----------------------------------------------------- flowers.dat (file information, lists flower and temp it needs to grow) AstilbeShadeMarigoldSunBegoniaSunPrimroseShadeCosmosSunDahliaSunGeraniumSunFoxgloveShadeTrilliumShadePansySunPetuniaSunDaisySunAsterSun -------------------------------------------- GIVEN CODE: # Flowers.py - This program reads names of flowers and whether they are grown in shade or sun from an input # file and prints the information to the user's screen. # Input: flowers.dat. #…arrow_forwardYou've been hired by Planet Pals to write a C++ console application that reads and converts planet data. Create text file PlanetsIn.txt and paste this data into it: Planet Diameter (miles) Length of Day (hours) Mercury 3032 4222.6 Venus 7521 2802.0 Earth 7926 24.0 Moon 2159 708.7 Mars 4221 24.7 Jupiter 88846 9.9 Saturn 74897 10.7 Uranus 31763 17.2 Neptune 30775 16.1 Pluto 1485 153.3 Place the file in a folder where your development tool can locate it. Read the file by scanning past the header row. Print a file-reading message, and the column headers. Each detail row in the file contains three tokens (planet, diameter, length of day) so you may do one token per read. For each detail row: Read each token from the file. Convert the diameter from…arrow_forward
- Create a program that stores the names of the user's friends in a list. The program should allow a user to add friends to the list, remove friends from the list, and display the entire list of friends. A menu should be created that displays those options like so: 1 - View all 2 - Add Friend 3 - Remove Friend 4 - Exit The program should continue in a loop until the user chooses to exit.arrow_forwardAdd a main function () in main.py and 3 other functions with 3 parameters and 2 arguments in a seperate module file, while using return statements to return the values. Use 3 predefined modules in your code and add a menu to the main.py file in the code below: main.py Code: from TicTac import gameif __name__ == "__main__": game() TicTac.py code: import randomfrom display import printBoard theBoard = {'7': '7' , '8': '8' , '9': '9' , '4': '4' , '5': '5' , '6': '6' , '1': '1' , '2': '2' , '3': '3' } board_keys = [] for key in theBoard: board_keys.append(key) #main function which will have all the gameplay functionality.def game(): turn = 'X' count = 0 while(True): printBoard(theBoard) move =str(random.randint(1,9)) print("It's " + turn + " turn and location is "+move) if theBoard[move] == move: theBoard[move] = turn count += 1 else: print("That place is already filled.\nMove to which place?")…arrow_forwardCMPSC 125: C++ Programming Programming Project Assignment Program Description: This assignment focuses on while loops and random numbers. Turn in a file named Lab4_yourFirstName.cpp. Your program allows the user to play a game in which the program thinks of a random integer and accepts guesses from the user until the user guesses the number correctly. After each incorrect guess, you will tell the user whether the correct answer is higher or lower. The below shows one sample execution of your program. Your output will differ depending on the random numbers chosen and user input typed, but the overall output structure should match that shown below: I am thinking of a number between 1 and 100 Your guess? 50 [Enter] It's lower Your guess? 25 [Enter] It's higher Your guess? 35 [Enter] It's lower Your guess? 30 [Enter] It's higher Your guess? 32 (Enter] It's lower Your guess? 31 [Enter] You got it right in 6 guesses! Do you want to play again? Y[Enter] I am thinking of a number between 1 and…arrow_forward
- A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txtand the contents of ParkPhotos.txt are:…arrow_forwardThe photo talley.jpg is opened for you and saved into the variable photo. You munt edit the image so there is NO blue color is remaining in the photo variable. This is to be done with indexing. Once the blue color has been taken out., use inshow to view the newly edited image. Script o C Reset I MATLAB Documentation read in the photo using imread 2 photo = imread(talley.jpg"); imshow(photo); Ndisplaying the original image 4figure();X the photo will blue renoved will be shown in a different figure 5* take the blue out of the photo X use imshow to view the new, edited photoarrow_forwardC++ programming language Images attached are the task and targeted output. I was asked to modify "DynamicStringArray.cpp" file to make the program output the correct output. PLEASE i only have to modify the "DynamicStringArray.cpp" code below to make the program right. Please help me. BELOW ARE THE PROVIDED CODES IN ORDER TO COMPLETE IT: But i only have to modify "DynamicStringArray.cpp" DynamicStringArray.cpp: // Write the implementation of every method of the class// DynamicStringArray defined in DynamicStringArray.h#include "DynamicStringArray.h"//default constructorDynamicStringArray ::DynamicStringArray (){//write code body of DynamicStringArray ()}int DynamicStringArray ::sizeIs(){//write code body of sizeIs ()}void DynamicStringArray ::addEntry (string str){//write code body of addEntry ()};bool DynamicStringArray::deleteEntry (string str){//write code body of deleteEntry ()}string* DynamicStringArray::getEntry(int index){//write code body of deleteEntry…arrow_forward
- In C write a program that takes a file name and two strings as command line arguments, and writes the longer of the two strings to the file with the given name. If the given strings are the same length, write the first string given to the file. If the user does not provide the correct number of command line arguments, print an error message and exit the program with a non-zero exit code.arrow_forwardplease write in C++.arrow_forward• Use a while loop • Use multiple loop controlling conditions • Use a boolean method • Use the increment operator • Extra credit: Reuse earlier code and call two methods from main Details: This assignment will be completed using the Eclipse IDE. Cut and paste your code from Eclipse into the Assignment text window. This is another password program. In this case, your code is simply going to ask for a username and password, and then check the input against four users. The program will give the user three tries to input the correct username-password combination. There will be four acceptable user-password combinations: • alpha-alpha1 • beta-beta1 • gamma-gamma1 • delta - delta1 If the user types in one of the correct username-password combinations, then the program will output: "Login successful." Here are a couple of example runs (but your code needs to work for all four user-password combinations): Username: beta Type your current password: beta1 Login successful. Username: delta Type…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education