School management system | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

School management system

1. Write a Java program that generates random numbers with your ID as the Class Name. Use a Do-While loop and a method to display a Menu Interface with the following options 1 - Register 2 - View When the user selects option 1: The program must ask the user to register by taking the following details with the help of a method called Register a. Index Number b. First Name c. Last Name d. Department e. Level f. Age This information must be written to a text file called Random Numbers. The program must now use a For loop to generate the random numbers with the users age as the seed in the following format: XXXX - XXXX - XXXX (where X can be any alphanumeric character) When the user selects option 2: The program asks for the users Index Number The program checks if a random number has been generated for the user previously in the text file. If Yes: the program displays the Random Number If No: the program displays an error message using Try-Catch and displays the menu screen again.

9th Mar 2021, 4:33 PM
Nkrumah Alfred
Nkrumah Alfred - avatar
2 Answers
0
do you think we will do your assignement for you? you should at least provide your code attempt in order to get helped ;P
9th Mar 2021, 6:36 PM
visph
visph - avatar
- 2
import java.io.*; import java.nio.file.Files; import java.util.Scanner; import java.util.Random; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws IOException { Random dice = new Random(); for (int counter = 1; counter <=1; counter ++){ dice.setSeed(age); age = dice.nextInt(); System.out.println("Your Pin is: " + age + ""); pw.println("Random Number: " + age); pw.close(); } }
11th Mar 2021, 4:45 PM
I_AM_SUPERSTAR
I_AM_SUPERSTAR - avatar