Question: 1 ) Explain where and why the program went wrong / and or not a good ( use line numbers ) . 2 ) Fix
Explain where and why the program went wrongand or not a good use line numbers
Fix them to get accurate results and smart program You don't have to rewrite the whole program, just explain how to fix them use line numbers
import java.util.;
import java.io;
class Personinfo
String type;
String name;
String gender;
int age;
public class People
static ArrayList List new ArrayList;
People String file throws FileNotFoundException
Scanner input new Scanner new File peopletxt;
while inputhasNext
PersonInfo p new PersonInfo;
ptype input.next;
pname input.next;
pgender input.next;
page input.nextInt;
list.addp;
public void listString occupation
String typeString ;
if occupationequalss
typeString "student";
ifoccupationequalst
typeString "teacher";
System.out.printlnList of people";
System.out.printfType: s
typeString;
for int i ; i list.size; i
if listgetitype.equalstypeString
System.out.printlnlistgeti;name;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
