Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
Chapter 13, Problem 8PE
a.
Program Plan Intro
Student progression
Program plan:
- Import necessary packages and create a class “StudentsStanding”,
- Define the method “main()”,
- Create “Scanner” object.
- Get both the file paths.
- Initialize required string and final variables.
- Set the cutoff value for grade point average.
- Execute “try” statement,
- Create output stream object.
- Create object for “BufferedWriter”.
- Create another output stream object.
- Create another object for “BufferedWriter”.
- Prompt the user to enter student id.
- Get the student id from the user.
- Execute “while” loop till the string is equal to “zzz”,
- Prompt the user to enter first name.
- Get the first name from the user.
- Prompt the user to enter last name.
- Get the last name from the user.
- Prompt the user to enter grade point average.
- Get the grade point average from the user.
- Concatenate the resultant string.
- Check if gpa is less than cutoff value,
-
- Write the data into the corresponding file.
- Otherwise,
-
- Write the data into another file.
- Prompt the user to enter the input.
- Get the input from the user.
- Close both the files.
- Catch if exception occurs,
- Handle the exception.
- Define the method “main()”,
b.
Program Plan Intro
Printing the details of student progression
Program plan:
- Import necessary packages and create a class “StudentsStanding2”,
- Define the method “main()”,
- Get both the file paths.
- Initialize required string variable.
- Execute “try” statement,
- Create input stream object.
- Create object for “BufferedReader”.
- Create another input stream object.
- Create another object for “BufferedReader”.
- Print heading.
- Read line from a file.
- Execute till there are records,
- Call the method “display()”.
- Read next line from a file.
- Print another heading.
- Read line from another file.
- Execute till there are records,
- Call the method “display()”.
- Read next line from a file.
- Close both the files.
- Catch if exception occurs,
- Handle the exception.
- Define the method “display()”,
- Create string array.
- Declare necessary variables.
- Set the cutoff value.
- Split the values using the delimiter “,”.
- Assign the value for string id.
- Assign the value for first name.
- Assign the value for last name.
- Assign the value for gpa.
- Print the resultant string to the console.
- Define the method “main()”,
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Using Java, Write an interactive console application for an employee management service. The user can enter the following options for the apps
1-List all employees, sorted by Name.
2-Hire a new employee (add to list)
3-show the lowest salary and highest salary and average of the salaries
0-exit -
At the beginning of the application, data will be read from a text file.
- And at the end of it when user chooses 0, data will be saved to the same file.
- The date format needs to be YYYY-MM-DD and The fields needs to be separated by semicolon(;)
Example of data in the text file : Alice P.;2012-09-22;Shoes;40
Emma W.;2016-07-07;Furniture;30
Eva;2021-08-08;Pizza;50
EmployeeSchedule class has the following attributes
private String name;
private String department;
private Date dateHired;
private double hourSalary;
name : between 2-50 characters and not permitted to have ;^?@!~*
department : between 2-50 characters and not permitted to have ;^?@!~*
dateHired : between 1900 and 2100 salary :…
Create a file in your project named employees.txt with the following data (you can simply create the file by hand rather than with Python code):
123 Bob Smith345 Anne Jones256 Carol Lee845 Steve Robert Anderson132 Jill Thompson
From your program's main function, give the user the following options: lookup a name based on ID number, lookup an ID number based on name, and quit the program.
OPTION 1: The user chooses to lookup a name based on ID number:
Use a try/except and ask the user to enter an integer.
If they don't enter an integer, print an error message.
If they do enter an integer, call a function named lookup_employee which takes the id as a parameter.
If an employee with the given id number is found, return the name.
Otherwise, return the string “Employee not found”
Back in main, print the return result.
OPTION 2: The user chooses to lookup an ID based on name:
Ask the user to enter the first and last name (don't ask for the middle name).
Call a function named…
Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file
.Prompt the user to enter the - Item Name
Item Quantity
Item Price
Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made
Save the item name, quantity, item price, and extended price to a file
When you create the file, prompt the user for the name they want to give the file
Separate the items saved with commas
Each entry should be on a separate line in the text file
Ask the user if they have more items to enter
Once the user has finished entering items
Close the file with the items entered
Display the sales total
If the sales total is more than $100
Calculate and display a 10% discount
Calculate and display the sales tax using 8% as the sales tax rate
The sales tax should be calculated on the sales total after the discount
Display the total for the sales receipt
Chapter 13 Solutions
Java Programming (MindTap Course List)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Each of the following files in the Chapter.10 folder of your downloadable student files has syntax and/or logical errors. In each case, determine the problem and fix the program. After you correct the errors, save each file using the same filename preceded with Fixed. For example, DebugTen01.cs will become FixedDebugTen01 .cs. a. DebugTen01.cs b. DebugTen02.cs c. DebugTen03.cs d. DebugTen04.csarrow_forwardEach of the following files in the Chapter.05 folder of your downloadable student files has syntax and/or logical errors. In each case, determine the problem, and fix the program. After you correct the errors, save each file using the same filename preceded with Fixed. For example, save DebugFive1.cs as FixedDebugFive1 .cs. a. DebugFive1.cs b. DebugFive2.cs c. DebugFive3.cs d. DebugFive4.csarrow_forwardEach of the following files in the Chapter.01 folder of your downloadable student files has syntax and/or logical errors. In each case, determine the problem and fix the program. After you correct the errors, save each file using the same filename preceded with Fixed. For example, DebugOne1.cs will become FixedDebugOne1 .cs. a. DebugOne1.cs b. DebugOne2.cs c. DebugOne3.cs d. DebugOne4.csarrow_forward
- Create a program named FileComparison that compares two files. First, use a text editor such as Notepad to save your favorite movie quote. Next, copy the file contents, and paste them into a word-processing program such as Word. Then, write the file-comparison application that displays the sizes of the two files as well as the ratio of their sizes to each other. To discover a files size, you can create a System. 10. Filelnfo object using statements such as the following, where FILE_NAME is a string that contains the name of the file, and size has been declared as an integer: FileInfo fileInfo = new FileInfo(FILE_NAME); size = fileInfo.Length;arrow_forwardCreate an application named StudentsStanding.java that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Have the program accept input until ZZZ is entered for the ID number. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing or those on academic probation. Create an application named StudentsStanding2.java that displays each record in the two files created in the StudentsStanding application. Display a heading to introduce the list produced from each file. For each record, display the ID number, first name, last name, grade point average, and the amount by which the grade point average exceeds or falls short of the 2.0 cutoff. For example, the output should be formatted as follows (note that the student info may vary): Probationary Standing ID #10 Mike Green GPA: 1.9 -0.10000000000000009 from 2.0 cutoff Good Standing ID #100 Jill Green…arrow_forwardCreate an application named StudentsStanding.java that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Have the program accept input until ZZZ is entered for the ID number. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing or those on academic probation. Create an application named StudentsStanding2.java that displays each record in the two files created in the StudentsStanding application. Display a heading to introduce the list produced from each file. For each record, display the ID number, first name, last name, grade point average, and the amount by which the grade point average exceeds or falls short of the 2.0 cutoff. For example, the output should be formatted as follows (note that the student info may vary): Here is the code so far: import java.nio.file.*; import java.io.*; import static java.nio.file.StandardOpenOption.*;…arrow_forward
- Create an application named StudentsStanding.java that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Have the program accept input until ZZZ is entered for the ID number. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing or those on academic probation. Create an application named StudentsStanding2.java that displays each record in the two files created in the StudentsStanding application. Display a heading to introduce the list produced from each file. For each record, display the ID number, first name, last name, grade point average, and the amount by which the grade point average exceeds or falls short of the 2.0 cutoff. For example, the output should be formatted as follows. Java languagearrow_forwardCreate an application named StudentsStanding.java that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Have the program accept input until ZZZ is entered for the ID number. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing or those on academic probation. Create an application named StudentsStanding2.java that displays each record in the two files created in the StudentsStanding application. Display a heading to introduce the list produced from each file. For each record, display the ID number, first name, last name, grade point average, and the amount by which the grade point average exceeds or falls short of the 2.0 cutoff. For example, the output should be formatted as follows (note that the student info may vary): Probationary Standing ID #10 Mike Green GPA: 1.9 -0.10000000000000009 from 2.0 cutoff Good Standing ID #100 Jill…arrow_forwardPlease only answer number 1, I will post the two parts separately so for now, just do number 1, THANKSarrow_forward
- You develop a Python application for your school. You need to read and write data to a text file. If the file does not exist, it must be created. If the file has content, the content must be removed. Which code should you use? Group of answer choices open(“local_data”, “r”) open(“local_data”, “w+”) open(“local_data”, “r+”) D. open(“local_data”, “w”)arrow_forwardSlide Type Slide • Exercise # 4 A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: • The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), • The amount of the sale, and the date of that event. • Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exit or the format of the record is incorrect. No need to display anything else in this regard. Note that you can assume that the dates are entered correctly (no need to validate them). You may also assume that the name of the input text file is inputex4.txt. • Make sure you use a dictionary in your solution. • Sample run is included below for the given input file inputex4.txt Summary of total sales according to services Dinner 634.75 Conference 1133.25 Lodging Dinner and Lodging 550.25 625.14 Slide Tyne Fragment varrow_forwardWrite an application that allows a user to input customer records (ID number, first & last name, and balance owed) and save each record to a filearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License