Question

1. You need to be able to open and read the text files that have been provided for the project. Write a Java program that rea



I've done all questions except question 6. how do I do this? please help.
code needs to be java

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Open JDK Runtime Environment (build 10.0.2+13-Ubuntu-lu .04.4) ? javac -classpath .:/run dir/junit-4.12.jar -d . Main > java

code:

import java.util.Scanner;

class Main {

public static void main(String[] args) {

//variable to store user choice

int choice=0;

//scanner variable to take input

Scanner sc = new Scanner(System.in);

//loop untill user choice is exit

while(choice!=5){

System.out.println("\n1.Display Drivers\n2.Import InfregmentFile\n3.Generate Suspension Report\n4.Save Driver Records\n5.Exit Program");

choice = sc.nextInt();

if(choice!=5)

System.out.println("You choose option "+choice);

}

}

}

Add a comment
Know the answer?
Add Answer to:
I've done all questions except question 6. how do I do this? please help. code needs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In java Objectives: In this lab, the following topics will be covered: 1. Text Files 2....

    In java Objectives: In this lab, the following topics will be covered: 1. Text Files 2. Binary Files Exercise 1 Create an array of Course objects taken from the user. The class Course has the following attributes: code like "ICS201", name like "Introduction to Computing II", and credit hours like 4. Save the array to both a text file, and a binary file. Exercise 2 Write a program that reads the text file created in Exercise 1 into an array...

  • code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation...

    code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation class with the following: ticket price (double type) and mumber of stops (int type). A CityBus is a PublicTransportation that in addition has the following: an route number (long type), an begin operation year (int type), a line name (String type), and driver(smame (String type) -A Tram is a CityBus that in addition has the following: maximum speed (int type), which indicates the maximum...

  • In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program...

    In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program to create a database of dogs of your own. You will also include File I/O with this program. You will create 3 classes for this assignment. The first class: Create a Class representing the information that is associated with one item (one dog) of your database. Name this class Dog. Using Lab 3, this will include the information in regard to one dog. The...

  • Programming Assignment 6 Write a Java program that will implement a simple appointment book. The ...

    Programming Assignment 6 Write a Java program that will implement a simple appointment book. The program should have three classes: a Date class, an AppointmentBook class, and a Driver class. • You will use the Date class that is provided on Blackboard (provided in New Date Class example). • The AppointmentBook class should have the following: o A field for descriptions for the appointments (i.e. Doctor, Hair, etc.). This field should be an array of String objects. o A field...

  • do this in java and as simple as possible as i am new to this. The...

    do this in java and as simple as possible as i am new to this. The lab10.xml is here and the zip file is here Thank you Create a program called ReadNames FromXML that reads the file lab10.xml (also in a ZIP file here for download), stores each string of the file into an array list and displays each name. On the documentation page for XMLDecoder you will find that exceptions can arise when this program runs: FileNotFoundException: when the...

  • JAVA program. I have created a game called GuessFive that generates a 5-digit random number, with...

    JAVA program. I have created a game called GuessFive that generates a 5-digit random number, with individual digits from 0 to 9 inclusive. (i.e. 12345, 09382, 33044, etc.) The player then tries to guess the number. With each guess the program displays two numbers, the first is the number of correct digits that are in the proper position and the second number is the sum of the correct digits. When the user enters the correct five-digit number the program returns...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...

  • Please make it sure your answers are meet what question needs with details I do not accept (copy ...

    Please make it sure your answers are meet what question needs with details I do not accept (copy / post) Using NetBeans IDE and write a CLI application that uses the BufferedWriter to write data to the file named "CustomerList.txt". =========================================================================== The application should follow this information A. Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. Save the program asWriteCustomerList.java.When you...

  • I am struggling with a program in C++. it involves using a struct and a class...

    I am struggling with a program in C++. it involves using a struct and a class to create meal arrays from a user. I've written my main okay. but the functions in the class are giving me issues with constructors deconstructors. Instructions A restaurant in the Milky way galaxy called “Green Alien” has several meals available on their electronic menu. For each food item in each meal, the menu lists the calories per gram and the number of grams per...

  • In Java. Write a GUI contact list application. The program should allow you to input names...

    In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT