Question
Arrays w/ User Input Objective: Create a program that allows a user to fill in values for two separate arrays, then prints the values for
Arrays w/ User Input
Objective: Create a program that allows a user to fill in values for two separate arrays, then prints the values for both arrays.
Related SLOs:
SLO #1: Use an appropriate programming environment to design, code, compile, run, and debug computer programs.
SLO #3: Illustrate basic programming concepts such as program flow and syntax of a high-level general-purpose language and basic security practices.
SLO #4: Demonstrate working with primitive data types, strings, and arrays.
Instructions:
Using jGRASP, write a Java program named LastnameFirstname07.java, using your last name and your first name, that does the following:
Create two arrays that will hold related information.
You can choose any information to store, but here are some examples:
an array that holds a person's name and an array that hold's their phone number
an array that holds a pet's name and an array that holds what type of animal that pet is
an array that holds a student's name and an array that holds what their grade is.
Ask the user how many entries to store. Allow a user to fill in the information for the arrays, using one loop.
Use one loop to print out the contents of both arrays so that the information in the different arrays are presented in a coherent manner.
Examples:
Tom's phone number is: 455-0123
Ed's phone number is: 455-0987
Blanca's phone number is: 455-3456
Snoopy is a pet dog
Garfield is a pet cat
Pudge is a pet fish
William : B
Mike : C
Pete : A
Note: You can make your arrays hold whatever information you want. You don't need to follow the examples. Be creative as you wish! :)
Your program MUST:
Actively use in-line comments stating what each section of code does.
Use try/catch if, and only if, necessary.
Begin storing data in the first box of the array - not the second.
Use no more than 2 loops in the entire program.
Your program must conform to the Java coding standards reviewed in class.
Your program should not use code/concepts we have not yet covered. You must demonstrate that you have mastered the concepts covered in class.
Remember to always begin your code with the following documentation comments:
/**
* Short description of the program.
*
* @author Last Name, First Name
* @assignment ICS XXX Assignment XX
* @date Today's Date
* @bugs Short description of bugs in the program, if any.
*/
Expected Output:
This is an example of what your program should output:
----jGRASP exec: java DoeJohn07
Hello! This is a phonebook program!
This program will allow you to enter in a person's name and their phone number.
How many entries would you like to store?
5
Okay! You can store 5 entries into this phonebook.
Please enter a name: John
Please enter their phone number: 455-0123
Please enter a name: Edward
Please enter their phone number: 455-0987
Please enter a name: Blanca
Please enter their phone number: 455-3456
Please enter a name: William
Please enter their phone number: 455-0000
Please enter a name: Pete
Please enter their phone number: 455-9999
John's phone number is: 455-0123
Edward's phone number is: 455-0987
Blanca's phone number is: 455-3456
William's phone number is: 455-0000
Pete's phone number is: 455-9999
----jGRASP: operation complete.
Criteria:
-Compiling, correct output, and avoiding thrown exceptions
-Correct use of arrays, if statements, and loops
-Complying with Java coding standards.
-Documentation comment included and complete, file name follow the specified format, your name is included in the file name,
correct file attached, etc.
-No miscellaneous mistakes, bugs, or problems.
Step by Step Solution
3.46 Rating (162 Votes )
There are 3 Steps involved in it
Step: 1
Based on the instructions provided Ill guide you through writing a Java program that meets the described objectives and criteria Program Structure 1 P...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started