0% found this document useful (0 votes)
19 views

Creating Methods With A Menu

The document outlines requirements for a menu-driven program with three options: 1. Create an email address from a user's name by combining their initials with their last name and appending "@google.com". 2. Prompt the user for an integer between 1 and 12 and print out the times table for that number. 3. Allow the user to exit the program. It then provides pseudocode for the program structure and methods to implement each menu option.

Uploaded by

Judith Nelson
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Creating Methods With A Menu

The document outlines requirements for a menu-driven program with three options: 1. Create an email address from a user's name by combining their initials with their last name and appending "@google.com". 2. Prompt the user for an integer between 1 and 12 and print out the times table for that number. 3. Allow the user to exit the program. It then provides pseudocode for the program structure and methods to implement each menu option.

Uploaded by

Judith Nelson
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Menu Application

Requirements

You are required to write a program which carries out both string functions and number
functions

Your system will have a menu which will present the user with three options:
Option 1 — allows the user to create a new email account it takes the first initials of the
firstname and combines it a period and the last name. It also adds on “@google.com”to
the end.
Option 2 prompts for an integer between 1 and 12 and prints out the timetables.

.Option 2 — will return the times table for a particular integer.

Option 3 – will allow the user to exit the program

Top Level design Level 1

Level 1 main method

1. prompt for and read in name


loop
2. prompt for and read in value for userOption
3. act on user choice
until userOption is 3 to end loop

Level 2 menu

1. prompt for and read in users fullname


1.1 Display Menu options
2. Call method menu()

2 menu()
Do
2.1 Prompt for and read value for userOption
2.2 switch userOption
case 1
3.1 call method getEmail(fullname)
break
case 2
3.2 call method printTimeTables()
case 3
3.3 Exit program
While userOption is not equal to 3 (quit option)
3.1 createEmail (string name)

3.2 create a substring of name taking the first initial

3.3 create two variables one to hold the first string and the other to hold the last
name.
3.4 use the indexof to separate the strings by the space in the word.
3.5 create a variable to hold the combined strings separated by a fullstop.

3.6 print out the new string with the users name and email e.g [email protected].

3.2 printTimesTables()
3.2.1 create scanner
3.2.2 prompt for integer between 1 and 12
3.2.3 get number
3.2.4 loop 12 times
3.2.2 display (number X currentLoopCounter = number * currentLoopcounter)
3.2.3.1 end loop

You might also like