/** To change this license header, choose License Headers in Project Properties.* To change this template file, choose Tools | Templates* and open the template in the editor.*/package assignment;import java.io.*;import java.util.*;/**** @author ghazal*/public class Assignment {/*** @param args the command line arguments*/public static void main(String[] args) throws Exception {// TODO code application logic hereint j, option;do {System.out.println("Enter the task you want to perform. ");System.out.println("1. Part 1(Writing)\n2. Part 2(Reading)\n3. Type \"0\" to exit.");option = in.nextInt();j=0;if (option!=0) {System.out.print("How many Students: ");j = in.nextInt();}in.nextLine();Students [] student = new Students[j];switch (option){case 1:part1(in, j, student);break;case 2:part2(in, j, student);break;case 0:break;default:System.out.println("You entered the Wrong input, please try again.");}}while(option!=0);}public static void part1(Scanner in, int j, Students [] objects) throws Exception{PrintWriter output = new PrintWriter("database.txt");for (int i = 0; i < j; i++) {objects[i] = new Students();System.out.print("Enter the name of the Student: ");
You've reached the end of your free preview.
Want to read all 3 pages?
Fall '18
main function, String section, public class Assignment