Write pseudocode, design flow chart and Java program using meaningful variable names, match logic specificed as in pseudocode and flow chart. Collect client information (Last name, first name, middle name (appear in one line) house/unit number, street name, type (appear in one line, city (by itself) & age (by itself) . Initial of first name with full stop, initial of middle name with full stop. Age brackets: 20 or under
21-35
36-70
71 or over
Pseudocode
Start
Declare variables lastName, firstName, middleName,
houseUnitNumber, streetName,city,age
Read Last name
Read first name
Read middle name
Read house/unit number
Read street name
Read city
Read age
Stop
Java code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter Last name: ");
String lastName = input.nextLine();
System.out.print("Enter first name: ");
String firstName = input.nextLine();
System.out.print("Enter middle name: ");
String middleName = input.nextLine();
System.out.print("Enter house/unit number: ");
String houseUnitNumber = input.nextLine();
System.out.print("Enter street name: ");
String streetName = input.nextLine();
System.out.print("Enter city: ");
String city = input.nextLine();
System.out.print("Enter age: ");
int age = input.nextInt();
input.close();
}
}
Comments
Leave a comment