Lab05
.docx
keyboard_arrow_up
School
Wayne State University *
*We aren’t endorsed by this school
Course
3020
Subject
Computer Science
Date
Dec 6, 2023
Type
docx
Pages
4
Uploaded by MateMandrill3698
CSC 3020
Java
Programming
Lab 05
25 points
Due 10/12/2023 In Class
All assignments must be submitted by the Canvas.
No email or hard copy
is accepted. You
must follow the following format:
1.
include only the source file for each problem.
2.
Submit your file to the Canvas. You must submit your assignment on time; otherwise,
you will receive zero. In addition,
you cannot submit your file more than one time
.
3.
There will be several folders on the Canvas. You need to upload your file(s) using the
correct folder on the Canvas.
4.
Name each file: “
AccessID
_Lab05_
Q1
”.txt
5.
To upload your file(s):
1.
In Course Navigation, click the Assignments link.
2.
Click the title of the Lab.
3.
Click the
Submit
Lab button.
4.
Add
File
. ...
5.
Add Another
File
. ...
6.
Submit
Assignment. ...
7.
View
Submission
.
It is your responsibility to make sure that each file is uploaded correctly. If you
uploaded a wrong file, you receive zero; files will not be accepted after due date even if
you have a prove that the file is created before the due date.
Your program should be free of syntax errors (i.e. it must compile).
If it does
not, you will receive a zero.
Solution to this assignment will not be posted on Canvas; however, any question can be
discussed in the class upon request of a student.
Each solution text file MUST have the following flower box comment along with labels.
I would copy this into your code.:
/********************************************************************
Name:
Access ID:
Date:
mm/dd/yyyy
*******************************************************************/
CSC 3020
Java
Programming
Lab 05
25 points
Due 10/12/2023 In Class
Write a java program that simulates a Banking Application System (25 pts).
Coding Style
You must use appropriate variable names that are descriptive of the variable
contents, method function, etc.
You must use single-letter variables for for loops.
You must name variables, method names, and classes using standards presented in
class (i.e. camel case, or init capped).
When prompting for data, make sure there are no errors in response.
Respond
appropriately and then re prompt.
Each method MUST have a flower pot comment which also includes a description of
what the method does.
The Fan class
Design a
class
named
Fan to represent a fan. The
class
contains:
Three
constants
named
SLOW, MEDIUM, and FAST with the
values
1, 2, and 3 to
denote the fan speed.
The Fan class
A
private
int
data field
named
speed that specifies the speed of the fan (the
default
is SLOW).
A
private
Boolean
data field
named
on that specifies
whether
the fan is on (the
default
is
false
).
A
private
double
data field
named
radius that specifies the radius of the fan
(the
default
is 5).
A
string
data field
named
color that specifies the color of the fan (the
default
is blue).
The accessor and mutator
methods
for all four data fields.
A no-arg
constructor
that creates a
default
fan.
A
method
named
toString() that returns a
string
description for the fan.
o
If the fan is on, the
method
returns the fan speed, color, and radius in one
combined
string
.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Create a simple program for a quiz
Software Requirements:
Latest version of NetBeans IDE
Java Development Kit (JDK) 8
Procedure:
Create a folder named LastName_FirstName (ex. Dahan yoon) in your local
Create a new project named LabExer5B. Set the project location to your own
The program shall:
contain an array of 10 multiple choice questions with three (3) choices each and
require the user to choose among A, B, or C;
Note: Cases are ignored. Lowercase letters are acceptable (a, b, c).
Create a try-catch structure to handle three (3) exceptions. These are when the user inputs the following:
an invalid letter (not A, B, or C)
a number or any special character
blank (no answer)
Prompt the user that he can answer again if any of the three (3) exceptions is
Display the score.
arrow_forward
Software Requirements:
Latest version of NetBeans IDE
Java Development Kit (JDK) 8
Procedure:
1. Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local drive.
2. Create a new project named LabExer6A. Set the project location to your own folder.
3. Create a simple guessing game (similar to Hangman or Hangaroo). In this game, the user guesses
a letter and then attempts to guess the word.
4. Create a Notepad file named words.txt which will store any number of words each written per line.
5. The Java program shall:
• randomly select a word from the list saved in words.txt;
• display a letter in which some of the letters are replaced by ?; for example, ED??A??ON
(for EDUCATION);
place the letter in the correct spot (or spots) in the word each time the user guesses a letter
correctly;
• inform the user if the guessed letter is not in the word; and
display a congratulatory message when the entire correct word has been deduced.
arrow_forward
JAVA LANGUAGE
arrow_forward
Assessment Description
Honors Students: Complete this assignment according to the directions provided in the "Honors Addendum," located in Class Resources.
This activity has multiple parts. All parts must be completed prior to documentation submission.
Part 1: Reading and Writing Text Files.
In this activity, you will learn how to read and write text files using non buffered and buffered File I/O classes, then learn how to parse a String into tokens using the String split() method, and finally, how to handle exceptions using various approaches.
Part 2: Reading and Writing JSON Files.
In this activity, you will learn how to read, write, and serialize JSON files to and from Java Objects.
Refer to the instructions within "Activity 4 Guide" to complete the assignment.
APA style is not required, but solid academic writing is expected.
This assignment uses a rubric. Please review the rubric prior to beginning the assignment to become familiar with the expectations for successful…
arrow_forward
Course Title : Operating SystemQuestion :
How you will create new user using terminal in Ubuntu? Add screenshots of all steps for new user creation including terminal and Login page in Answer sheet. Every student has to create new user as of his/her arid number for example (18-arid-2929).
Note: screenshots are mandatory.
arrow_forward
Laboratory Exercise Guessing Game 2
Objective:
At the end of the exercise, the students should be able to:
Create a simple game that exhibits file input and
Software Requirements:
Latest version of NetBeans IDE
Java Development Kit (JDK) 8
Procedure:
Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local
Create a new project named LabExer6A. Set the project location to your own
Create a simple guessing game (similar to Hangman or Hangaroo). In this game, the user guesses a letter and then attempts to guess the
Create a Notepad file named txt which will store any number of words each written per line.
The Java program shall:
randomly select a word from the list saved in txt;
display a letter in which some of the letters are replaced by ?; for example, ED??A??ON (for EDUCATION);
place the letter in the correct spot (or spots) in the word each time the user guesses a letter correctly;
inform the user if the guessed letter is not in the word; and…
arrow_forward
PHONE DIRECTORYDescription: Create a phonebook directory that will store the contact numbers of N persons. Your program should allow the user to add, view, delete, and update the contacts in the phonebook. Note that one person can have multiple contact numbers. The program will stop when the user command is ‘X’. Program command and entry should not be case-sensitive. That means commands ‘I’ or ‘i’ and the name “Jacky” or “JACKY” are the same. Each contact number can be 7 digits or 11 digits only.
The user should input a string containing the command, name, and contact number(s) (Limit the contact number of each person to three). This string should be broken down into fields in order to separate the different values and store them in their appropriate variables.
Use linked list in the implementation. Your node must declare at least four instance variables.
Program flow:
Command> I Jacky 09211234567 Remarks: New contact has been added. Command> V Jacky Contact…
arrow_forward
Programming Fundamentals
Spring 2020 - 2021
Practical Exam 1
Weight 7 marks
Date 19/05/2021
Write a java program that reads one number, and display your full name many
times as the number is read.
Exam submission instructions:
1- You must submit the file with ".java" extension.
2- You must submit a video that record your computer screen when you are writing the
program. The video must be uploaded to google drive then add video link with
assignment submission. The assignment will not be marked without screen recording
video.
of
arrow_forward
✓ Exercises
Exercise: Write a method _ and _ that computes the region representing the intersection of two regions.
Exercise: Write a method
_contains__, which checks whether a n-dimensional point belongs to the region. Remember, a point belongs to the
region if it belongs to one of the rectangles in the region.
✓ Membership of a point in a region
#@title Membership of a point in a region
def region_contains (self, p):
### YOUR SOLUTION HERE
Region._contains = region_contains
[ ] # Tests 10 points.
assert (2, 1) in Region (Rectangle((0, 2), (0, 3)), Rectangle((4, 6), (5,8)))
assert (2, 1) not in Region (Rectangle((0, 1), (0, 3)), Rectangle((4, 6), (5, 8)))
Exercise: Write a method _le_ for regions such that R <= S if the region R is contained in the region S. You can test this by checking that
the difference between R and S is empty.
arrow_forward
java
You may NOT write this program as a GUI (Graphical User Interface).
Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this and so should your output file. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. This would be the folder that contains the src folder, probably named FileCopy depending on what name you gave the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself.
do not write to input.txt*
Your class name must be FileCopy.
It should be in a package named mypackage
arrow_forward
java
You may NOT write this program as a GUI (Graphical User Interface).
Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this and so should your output file. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. This would be the folder that contains the src folder, probably named FileCopy depending on what name you gave the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself.
I will test it with a file, input.txt
do not write to input.txt*
Your class name must be FileCopy.
arrow_forward
Step1-Study the scenario below and create a Java Program for Builders Warehouse, The program must consist of a class called Materials to handle the details of the materials.
Step 2-The program should read the materials details from the material.txt file then use a LinkedList to store the material details.
Step 3-Then finally the products stored in the LinkedList must be displayed like the sample code below:
Step 4-There must be clear code and a screenshot of the code running.
arrow_forward
Software Requirements:
• Latest version of NetBeans IDE
• Java Development Kit (JDK) 8
Procedure:
1. Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local drive.
2. Create a new project named LabExer5A. Set the project location to your own folder.
3. The program shall:
generate a random number from 1 to 50 for a player to guess;
• display a message that indicates whether the player's guess is correct, too low, or too high;
and
prompt the user to keep on guessing until the correct value is entered
4. Create a try-catch structure that will handle two (2) exceptions. These are when the user inputs the
following:
a number that is out of range (1 – 50)
a letter or any non-numeric character
5. Prompt the user so that he can guess again if an exception is thrown.
6. Display the number of total guesses.
Note: An invalid input (when an exception is thrown) is not considered a valid guess or attempt.
Sample Output:
Guess a number from 1 to 50!
30
Too high. Try again.
15
Too…
arrow_forward
Social Media is progressing day by day. It is becoming strong tool which anybody can use to become famous.
Celebrities also use social media for their publicity and popularity.
You are required to create a small application which keeps track of ten celebrities(using ArrayList) Instagram profile (name, id, followers) ask data from user write this data to file, after that read it from file and display who has highest followers on Instagram on the screen.
Create Profile class with above attributes and appropriate methods.
Then create File Manager Class which holds ArrayList of profile and read and write methods to write data to file and read from file.
In main ask values form user and then call appropriate methods, then display the values in the end along with the celebrity with highest followers
Programming language : Java
arrow_forward
Instead of making a class Serializable, the developer can write each of the member variables to a file. This process takes longer and requires more code.
True
False
arrow_forward
Screen shot please
arrow_forward
When it loads, the list of car objects should be created by reading from the above file. When Add Car
button is clicked the following screen should appear:
a Add a New Car
Model:
Year:
Çolor.
Mleage:
Cancel
Add
When the user fills out new car information and clicks "Add", the new car object is created, the form is
closed, so that the main form is shown again, and the newly created car object is added to the list of
cars. When "View cars" button is clicked, the following form shows, displaying all car objects currently in
the list (use Getlotel) function here. You will also have to send the list of cars from the main form to tis
form. To do this in the view form have a public variable for list of cars, and assign to it the list of cars
from the main form).
ag View Cars
Model: Accord, Year.20166 Year. 20166, Color: Blue, Mieage: 0
Model: Passat, Year:2014 Year: 2014, Color: White, Mileage: 20000
Close
arrow_forward
Step1-Study the scenario below and create a Java Program for Builders Warehouse, The program must consist of a class called Materials to handle the details of the materials. The program should read the materials details from the material.txt file then use a LinkedList to store the material details. Then finally the products stored in the LinkedList must be displayed like the sample code below
step 2-There must be clear code and a screenshot of the code running.
arrow_forward
import csv
# These are used to help you manage the CSV please do not change!input_handler = { "field goal": 10, "3 point": 13, "2 point": 16, "free throw": 20}
# This code assigns index_stat to the index of whatever value you enter.index_stat = -9999
# _______Begin student work after this line________
# These variables can be used to track the index of of certain values in the csv. # Use if you want.# index_name = ?# index_age = ?# index_team = ?
# Goal: take in a string containing a file name -> return a list of lists from a csv reader objectdef read_csv(filename): pass
# Goal: take in a team name and the dataset -> return a list of lists containing only player from the # specified team.def filter_data(team_name, data): pass
# For a given statistic find the player with the highest average.def find_best_player(data, index): pass
# For a given statistic find the player with the lowest average.def find_worst_player(data, index): pass
# Find the average age…
arrow_forward
The Problems - contains only problems from the last 2 contests
Separate Un-Attempted, Attempted and All cards Problem Difficulty Rating - The
Featured drop-down menu has different difficulty ranges so you can try problems that
best suit your experience.
Popular topics and brands Like most users, Chef didn't know that he could add
problems to his personal to-do list by clicking the magic "+" symbol in the upper
right corner of each problem page. But once he found out about it, he went crazy and
added a lot of problems to his to-do list without looking at their difficulty rating.
Rajesh is a beginner and ideally should only try to solve problems strictly below
10001000. Given the difficulty rating list of problems in Chef's to-do list, please help
him determine how many of these problems Chef should remove from his to-do list
so he is left with only problems with a difficulty rating of less than 10001000.
Note: Please answer the question in Python only:
Input
1
4
999 1000 1001 1002…
arrow_forward
In python, thank you
class variables needed for this task link https://pastebin.com/LH0u9ihn
arrow_forward
In C# language using Microsoft Visual Studio in Windows Forms App (.NET Framework)
A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine.
Create an application that simulates a slot machine.
The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols.
arrow_forward
The file Names.txt is located in the folder input_files within your project. The content of that file is shown in the following figure
Java:
import java.io.FileInputStream;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner;public class Question2 {public static void main(String[] args) throws FileNotFoundException {/*** Part a* Finish creating an ArrayList called NameList that stores the names in the file Names.txt.*/ArrayList<String> NameList;/*** Part b* Replace null on the right-hand-side of the declaration of the FileInputStream object named inputStream* so that it is initialized correctly to the Names.txt file located in the folder specified in the question description*/FileInputStream inputStream = null;Scanner scnr = new Scanner(inputStream); //Do not modify this line of code/*** Part c* Using a loop and the Scanner object provided, read the names from Names.txt* and store them in NameList created in Part a.*//*** Part d* Reorder the…
arrow_forward
This is test review, e is the correct answer. I do not know why the else statement overrides the else statement
arrow_forward
Computer science
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Related Questions
- Create a simple program for a quiz Software Requirements: Latest version of NetBeans IDE Java Development Kit (JDK) 8 Procedure: Create a folder named LastName_FirstName (ex. Dahan yoon) in your local Create a new project named LabExer5B. Set the project location to your own The program shall: contain an array of 10 multiple choice questions with three (3) choices each and require the user to choose among A, B, or C; Note: Cases are ignored. Lowercase letters are acceptable (a, b, c). Create a try-catch structure to handle three (3) exceptions. These are when the user inputs the following: an invalid letter (not A, B, or C) a number or any special character blank (no answer) Prompt the user that he can answer again if any of the three (3) exceptions is Display the score.arrow_forwardSoftware Requirements: Latest version of NetBeans IDE Java Development Kit (JDK) 8 Procedure: 1. Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local drive. 2. Create a new project named LabExer6A. Set the project location to your own folder. 3. Create a simple guessing game (similar to Hangman or Hangaroo). In this game, the user guesses a letter and then attempts to guess the word. 4. Create a Notepad file named words.txt which will store any number of words each written per line. 5. The Java program shall: • randomly select a word from the list saved in words.txt; • display a letter in which some of the letters are replaced by ?; for example, ED??A??ON (for EDUCATION); place the letter in the correct spot (or spots) in the word each time the user guesses a letter correctly; • inform the user if the guessed letter is not in the word; and display a congratulatory message when the entire correct word has been deduced.arrow_forwardJAVA LANGUAGEarrow_forward
- Assessment Description Honors Students: Complete this assignment according to the directions provided in the "Honors Addendum," located in Class Resources. This activity has multiple parts. All parts must be completed prior to documentation submission. Part 1: Reading and Writing Text Files. In this activity, you will learn how to read and write text files using non buffered and buffered File I/O classes, then learn how to parse a String into tokens using the String split() method, and finally, how to handle exceptions using various approaches. Part 2: Reading and Writing JSON Files. In this activity, you will learn how to read, write, and serialize JSON files to and from Java Objects. Refer to the instructions within "Activity 4 Guide" to complete the assignment. APA style is not required, but solid academic writing is expected. This assignment uses a rubric. Please review the rubric prior to beginning the assignment to become familiar with the expectations for successful…arrow_forwardCourse Title : Operating SystemQuestion : How you will create new user using terminal in Ubuntu? Add screenshots of all steps for new user creation including terminal and Login page in Answer sheet. Every student has to create new user as of his/her arid number for example (18-arid-2929). Note: screenshots are mandatory.arrow_forwardLaboratory Exercise Guessing Game 2 Objective: At the end of the exercise, the students should be able to: Create a simple game that exhibits file input and Software Requirements: Latest version of NetBeans IDE Java Development Kit (JDK) 8 Procedure: Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local Create a new project named LabExer6A. Set the project location to your own Create a simple guessing game (similar to Hangman or Hangaroo). In this game, the user guesses a letter and then attempts to guess the Create a Notepad file named txt which will store any number of words each written per line. The Java program shall: randomly select a word from the list saved in txt; display a letter in which some of the letters are replaced by ?; for example, ED??A??ON (for EDUCATION); place the letter in the correct spot (or spots) in the word each time the user guesses a letter correctly; inform the user if the guessed letter is not in the word; and…arrow_forward
- PHONE DIRECTORYDescription: Create a phonebook directory that will store the contact numbers of N persons. Your program should allow the user to add, view, delete, and update the contacts in the phonebook. Note that one person can have multiple contact numbers. The program will stop when the user command is ‘X’. Program command and entry should not be case-sensitive. That means commands ‘I’ or ‘i’ and the name “Jacky” or “JACKY” are the same. Each contact number can be 7 digits or 11 digits only. The user should input a string containing the command, name, and contact number(s) (Limit the contact number of each person to three). This string should be broken down into fields in order to separate the different values and store them in their appropriate variables. Use linked list in the implementation. Your node must declare at least four instance variables. Program flow: Command> I Jacky 09211234567 Remarks: New contact has been added. Command> V Jacky Contact…arrow_forwardProgramming Fundamentals Spring 2020 - 2021 Practical Exam 1 Weight 7 marks Date 19/05/2021 Write a java program that reads one number, and display your full name many times as the number is read. Exam submission instructions: 1- You must submit the file with ".java" extension. 2- You must submit a video that record your computer screen when you are writing the program. The video must be uploaded to google drive then add video link with assignment submission. The assignment will not be marked without screen recording video. ofarrow_forward✓ Exercises Exercise: Write a method _ and _ that computes the region representing the intersection of two regions. Exercise: Write a method _contains__, which checks whether a n-dimensional point belongs to the region. Remember, a point belongs to the region if it belongs to one of the rectangles in the region. ✓ Membership of a point in a region #@title Membership of a point in a region def region_contains (self, p): ### YOUR SOLUTION HERE Region._contains = region_contains [ ] # Tests 10 points. assert (2, 1) in Region (Rectangle((0, 2), (0, 3)), Rectangle((4, 6), (5,8))) assert (2, 1) not in Region (Rectangle((0, 1), (0, 3)), Rectangle((4, 6), (5, 8))) Exercise: Write a method _le_ for regions such that R <= S if the region R is contained in the region S. You can test this by checking that the difference between R and S is empty.arrow_forward
- java You may NOT write this program as a GUI (Graphical User Interface). Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this and so should your output file. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. This would be the folder that contains the src folder, probably named FileCopy depending on what name you gave the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself. do not write to input.txt* Your class name must be FileCopy. It should be in a package named mypackagearrow_forwardjava You may NOT write this program as a GUI (Graphical User Interface). Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this and so should your output file. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. This would be the folder that contains the src folder, probably named FileCopy depending on what name you gave the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself. I will test it with a file, input.txt do not write to input.txt* Your class name must be FileCopy.arrow_forwardStep1-Study the scenario below and create a Java Program for Builders Warehouse, The program must consist of a class called Materials to handle the details of the materials. Step 2-The program should read the materials details from the material.txt file then use a LinkedList to store the material details. Step 3-Then finally the products stored in the LinkedList must be displayed like the sample code below: Step 4-There must be clear code and a screenshot of the code running.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning