Project analyze, design, and document a simple program that utilizes a good desi
ID: 3557749 • Letter: P
Question
Project
analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array. The specific problem you need to solve for the project is:
Design a program that will allow a user to Input a list of your family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who lives in Texas.
There are 4 components of your submission including:
As recommendation, you can try to use Eclipse or NetBeans environments that are used also for other courses as: Introduction in Java programming and Intermediate programming.
All of these components should be placed in word document for submission.
The C code have to be a document written with a text editor or Notepad++ (http://notepad-plus-plus.org/)
All of these components should be placed in word document for submission.
Additional details about the program you need to write:
Example application test data:
Test Case #
Input
Expected Output
1
Name:Fred, Age: 82, State: MD
Name:Mary, Age:75, State: OH
Name:Joe, Age: 45, State: TX
Name:Julie, Age: 47, State: TX
Name:Beth, Age: 9, State: TX
Average Age: 51.6
Members who live in TX:
Joe
Julie
Beth
2
Your input data
Your expected output
3
Your input data
Your expected output
In our example the user of your program have to enter as input values:
Fred 82 MD
Mary 75 OH
Joe 45 TX
Juie 47 TX
Beth 9 TX
Test Case #
Input
Expected Output
1
Name:Fred, Age: 82, State: MD
Name:Mary, Age:75, State: OH
Name:Joe, Age: 45, State: TX
Name:Julie, Age: 47, State: TX
Name:Beth, Age: 9, State: TX
Average Age: 51.6
Members who live in TX:
Joe
Julie
Beth
2
Your input data
Your expected output
3
Your input data
Your expected output
Explanation / Answer
import java.util.Scanner;
public class State
{
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);
int age;
String name;
String state;
int averageAge;
System.out.print("Enter family member's name (or 'quit' to exit)");
name = input.next();
while (!name.equals("quit"))
{
System.out.print("Enter family member's age");
age = input.nextInt();
System.out.print("Enter family member's state");
state = input.next();
averageAge =age + age;//My problem at this level, im unable to calculate the aver
System.out.printf("the familys' average age is %d ", averageAge);
if (state.equals ("texas"))
{System.out.printf ("%s lives in texas ", name);}
System.out.print("Enter family member's name (or 'quit' to exit)");
name = input.next();
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.