NETbeans Java Program Project Follow instruction in the attachment. Dont miss out small thing in instruction. The lab is easy to follow but i got confused
NETbeans Java Program Project Follow instruction in the attachment. Dont miss out small thing in instruction. The lab is easy to follow but i got confused and couldnt proceed due to lack of knowledge. So i manage to learn along with assignment but for sure it could not complete therefore i posted it.
/**
*
* ID: 1000000000
* @authorSXB
*/
public classSXBLab1Task1
I have attach some work done on the assignment so i attached in my SXBLab5.docx
I also have attached some data from county file (SXB COUNTY DATA LAB5.docx) which i could get in this short period. ITS INCOMPLETE DATA. CSE Spring 20
Introduction to Programming
LAB5 CSE
Due:
Monday, May 6, 11:59pm **NO LATE LABS ACCEPTED FOR LAB5**
(New naming conventions and deductions were added on Lab . They are still marked with **)
The Lab assignment will be graded out of 100 points.
There are multiple parts or tasks that make up each Lab.
Instructions about answers document:
Some tasks ask you to write code, and specify what name to use for the file in NetBeans. You need
to use exactly the name that is given (do not change the case, or make any other modification).
Remember, the name of the main class must match the filename.
There are further instructions at the bottom (after the questions) about how to save the file from
NetBeans in order to be able to turn it in.
For every lab assignment you need to create an answers file. In this answers file you will put in
answer any questions that are asked, you will show the output of code that you write and you will
reference any code files that you create for a given question. See below for more details about
what goes in the answers file.
**NEW!!** For consistency, please use the following naming scheme for your answers document.
Your answers document needs to be named with your initials and the last four digits of your ID
number and then Lab#answers. So if my initials are JCMT and the last four digits of my ID are
1234, then the answers file for my Lab 4 would be JCMT1234Lab4answers.
The ONLY acceptable file formats are Word document, OpenOffice document, and PDF.
Put your last name, first name and ID in the file on the first line.[-5 deduction if not**]
Label the answers for each question with the number/letter of the question. Separate each
answer from the next answer by at least two blank lines. [-5 deduction if not**]
Include EVERY question number/letter combination from the assignment in your answers
document. If the question is a coding question telling you to save a file, for example some
question numbered 17.b), then in your answers document you should have a line like the
following for question 17.b):
17.b) Please see file Lab1Part3.java for this question.
Put all your question answers the answer document.
If the lab question asks you to show the output of a doing some particular thing with the
code, thenyou must also put a screenshot of the output in the answer document. For
output that takes up more than one screen, make multiple pictures so that every screen is
recorded. If you do not include the screenshotsin your answer document, then the
questions that should have had screenshots will be considered Not answered and will be
awarded ZERO 0 points.
Each task below will instruct you where to put your answers. If the task says to Save your
program as file XYZ1234Lab1Task1.java then this .java file should be turned in as part of the
assignment along with the answers file.
Instructions about Java files,i.e.the .java documents (same as Lab1):
Every document that is turned in MUST have your name and your student ID. This means that
your .java files must have your name and ID number in the comments at the top of the file. You
must put your name and ID just above the @author Javadoc comment that NetBeans puts in your
code. This should be just above the class header in the code. Ex:
/**
* Dr. T
* ID: 1000000000
* @author
*/
public class JCMT1234Lab1Task1
Every code file should have your initials and the last four digits of your ID number at the beginning
of the file name. For example, if my initials are JCMT and the last four digits of my ID are 1234,
then the Java code file for my Lab 1 Task 1 would be JCMT1234Lab1Task1.java. In the
questions below, the initials and digits are shown as XYZ1234 . Every code file name should start
with the initials and digits even if not explicitly listed. You will substitute your initials and digits
for the XYZ1234 part of the file name.
Also make sure that you change the comments to describe your own program. You MUST replace
the first three lines of comments (the part that starts with To change) with something like
CSE1310-005 Lab 3 Part 1 as was specified in the beginning of the Lab1 assignment. After the
label @author put your name as specified in the instructions for this lab assignment. We are not
using any parameters @param so you can leave that comment as is.
At the comment // under the main function header, REMOVE the statement that starts with
TODO code and put a one line description of what you are doing. You might type the following
for your comment:
// Lab 3 Part X code to
.
Summary of answer document and .java files prep
1 Create an answers file named with your initials and the last four digits of your ID number and
then Lab#answers that is of file type .docx, .pdf, or .odt
2 Put lastname, firstname and ID in the file then put every question number into the file.
3 Make sure to put some answer after every question number. The answer might be a written
answer, a pasted pic or screenshot, or a message indicating that the answer is in an external
file.
4
Make sure that when you create your Java programs, your program includes your name and ID
in the @author block. Also make sure your header comments describe your specific java
program and you remove the default messages and put in your own messages.
There is info at the bottom about creating a folder for your assignment files to be turned in and
submitting the assignment.
Instructions that apply to all lab questions:
A. For later labs, if the instructions say to use code from previous lab/question then everything
from previous question should still be in lab except what is explicitly changed in the current
question.
B. ** Things not allowed in 1310 class in Java programs.{More details about these things are given
the posted file Things Not Allowed} If you use these elements in your lab assignment Java
code, you will get a 0 (zero) for the entire question where you used this element.
1)
2)
3)
4)
5)
6)
7)
Cannot use exit
Cannot use Exception, the general Exception for exception handling
Cannot use throws
Cannot use break except between case statements in a switch structure
Cannot use continue
Cannot use an intentional infinite loop such as while (true)
Cannot use elements of Java that have not been discussed in class without talking to
Instructor **
Grading Rubric for Lab 5:
Lab 5 topics arrays, searching, sorting, string manipulation, 2D arrays
Part 1:81 pointsin four parts
Part 2: 19points
Miscellaneous: If you have questions, e-mail TAs.
Lab 5 parts to complete:
Part 1: For this problem you are going to create a program that will read in data from a file, store
the data in arrays, and then process the data. You are going to do this in stages so you need to do
the steps of the labs in order to make it work. Note that this looks the same as last time but you
will be doing different things.
1.a) Creating the input data file: You will need to create an input text file of data called
XYZ1234COVIDstco.txtthat will be in the form shown below. I will give you a partial data file to
start with but you must add more data to the text file as described below. The input text file will
have multiple lines. In the file there are two types of lines: state data lines and county data lines.
The state data lines are in the format below:
state_abbreviation COVID-19_cases community_transmissionstate_population
where
state_abbreviationis the two letter code for any US state or US territory
COVID-19_cases is an integer number of reported state cases of COVID-19 on the day you pick
community_transmission is the data from the Community Transmission column in the CDC.gov
state data table (https://www.cdc.gov/coronavirus/2019-ncov/cases-updates/cases-inus.html)
state_population is the integer population of the US state or US territory you abbreviated
Example state data would be:
TN 5823 Yes, defined area(s) 6829174
LA 21518 Yes, widespread 4648794
The COVID-19_cases value and the community_transmission valueshould come from the CDC.gov
website. (The values above are from mid-April. You should update all your COVID-19 data to the
same date)
The state_population should come from census.gov/quickfacts
hould use the estimated 2019 population (V2019)
The second type of line in the file are county data lines. The county data lines are in the format
below:
stateAbbreviation countytotalCasestotalTestedpopulationRank population
where:
stateAbbreviationis the two letter code for any US state or US territory (same as on state lines)
countyis one or more words that is the name of a county in that state
totalCasesis the integer total number of COVID-19 cases in that county
totalTestedis the integer total number of COVID-19 tests that have been performed in that county
populationRankis an integer value giving the rank of the county in terms of population in the state
populationis the integer population of the county
Example county data would be:
LA East Baton Rouge 1325 8382 1 444094
TN Sumner 478 2279 8 179473
NY Warren County 1054
63944
The data file must contain at least seven states (four will be given: AL, LA, TN, TX) so you must
gather data for at least 3 additional states. Other than TX and TN, none of your other 7 states
should start with the same letters; e.g. AZ is not allowed because AL is in the file already.For each
state, the file must contain a state data line and data for the 3 counties with the highest number of
COVID-19 cases AND the 3 counties with the highest population, i.e. the populationRankis 1, 2 or 3.
If these are overlapping sets or the same 3 counties, then just include each unique county once. In
the data file you will be given, two states have three counties listed and two states have four
counties listed because the county with the third highest population is NOT the county with the
third highest number of COVID-19 cases. Therefore, these two different counties are both
included. You could have as many as 6 lines of county data in your file or as few as three lines.
The values you use for the county data must be drawn from the state or county public health
websites. The county population may be drawn from a state website, a county website, or from a
website or group of websites that have statistics for all the states (see examples below for
demographics sites). In your answer document you must include the source websites where you
gathered your additional data. Your list does not need to include the sources for the data that is
given to you. Unfortunately, the data is generally not in consistent formats from state to state so
you will have to gather the data and then format it correctly. In your answers document also
include the date that you gathered your data. DO NOT change the given data; just add your data
from your sources on the date that you retrieve it.
The data in the given input file is from the sources below.
State data updated 15 April 2020 from cdc.gov and census.gov/quickfacts
AL by county data (cases, # tested, deaths) from https://dph1.adph.state.al.us/covid-19/
AL county pop https://www.alabama-demographics.com/counties_by_population
TX by county data (cases, # tested, deaths) downloaded from various TX sites including
https://www.dshs.texas.gov/coronavirus/ for cases and fatalities and
https://www.dshs.texas.gov/coronavirus/additionaldata/ for testing data
TX county pop https://www.dshs.state.tx.us/chs/popdat/st2019.shtm
TN by county data (cases, # tested, deaths) table data from
https://www.tn.gov/health/cedep/ncov.html
TN county pop https://www.tennessee-demographics.com/counties_by_population
LA by parish data (cases, # tested, deaths) table data from http://ldh.la.gov/Coronavirus/
LA parish pop https://www.louisiana-demographics.com/counties_by_population
The input data fileUSCOVID19StateCounty.txt,with the original data that I supply plus the data that
you add, must be included in the folder with your .java files. Your answer document must have the
sources for your additional data listed and the date your data was retrieved. {18 points}
Rubric:
For input file At least three additional states added with state line data {3pt}
At least three lines of county data added for each state that is added {3 pts}
Top three counties with COVID-19 cases are included for each state {3 pts}
Top three counties based on population are included for each state {3 pts}
For answers document Sources for all added file data are listed in answers document {5 pts}
Date that data was retrieved is listed in answers document {1 pt}
1.b) Create a new Java application called XYZ1234Lab5Part1b. After creating the data file in the
previous question, you are now going to write the first part of your programXYZ1234Lab5Part1b
to read the data from the file. For Part1b you are just going to focus on reading the data from the
file and printing it to verify that is was read correctly.
You will be given a .javafile, PrepLab5COVID.java, that contains declarations of some variables and
arrays and the set up for an output data file. It also contains output statements at the end that you
will use to print the headers for the table you will print using the data that is stored in your arrays.
There are two small methods defined at the bottom that assist with printing the output. You
should copy all of this code into your XYZ1234Lab5Part1b main method.
In the code you have just copied, you will see comment statements between the output data file
set up and the print statements for the header. These comments guide you through what you need
to do. More detail is given here:
// Set up input file and scanner
Use the ScannerinputFile and the File you need. Use the file that you created in Part1a as the input
data file. Connect the file to the Scanner to use for input.
// The next section should read in data line by line from input file into the appropriate arrays
Now you are ready to create the loop that will read in the data. Youll need to read until the end of
the data in the file is reached. Before the loop you should create two variables to use as the indices
for the arrays. One variable will be the index for all of the state arrays and the other variable will
be the index for the county arrays. Both indices will start at 0 and will be incremented whenever
data is added to the associated arrays.
// Inside the loop, read in a single line from the file and process that line
Read one line from the input file using the Scanner inputFile and assign that line of the file to the
Scanner fileLine. Use fileLine to read the individual data elements for one line.
// Inside the loop, determine line type by second element on the line
Reading from fileLine, read the first value on the line into a temporary String using one of the
declared variables. This value will always be a state abbreviation. However, the line may have
state data or county data. In order to determine what type of data is on the remainder of the line,
read the second value into another temporary String and then determine what kind of data has
been read. If the data is a number, then it represents COVID-19 cases and the line has state data
one it. If not, the line has county data on it. Once you have determined what kind of data is on the
line choose the appropriate action.
// Inside the loop, lines with state level data are stored in st arrays
For a line of state data, store the state abbreviation in the states array at the current state index.
Store the COVID-19 cases as a number into the stCases array. Read the whole community
transmission message, e.g. Yes, widespread and store in the stSpread array. [Hint: use a delimiter
to read the whole message.] Read the state population and store in the stPops array. Calculate the
floating pointpercentage of cases in the total populations of the state (cases / population * 100)
and store this value in stPct. Increment the state index.
// Inside the loop, lines with county level data are stored in co arrays
For a line of county data, store the state abbreviation in the coStatearray at the current county
index. Next, use delimiters to read the county name and store in the counties array. Read the
totalCasesvalue and store in the coCases array. For the three remaining numbers, read totalTested
and store in coTests, read populationRank and store in coPopRank, and read population and store
in coPops. Calculate the floating point percentage of tests in the total populations of the county
(tests / population * 100) and store this value in coPct. Increment the county index.
This should be the end of the loop reading from the file.
// After all data is read and stored, then output the data in tables using the formats given
// Print state data table with headers to screen and file
System.out.println(“COVID-19 cases for selected states”);
System.out.printf(“n%-4s%-10s%-15s%-12s%-25sn”,
“ST”, “Cases”, “Population”, “Percent”, “Spread”);
// Print data
Print the header into the output file just like it is printed to the screen. Print a dashed line after
each header using the methods that are given. Then in a loop, print all the data from the state
arrays in a table. Each line of the table should have the state abbreviation, number of cases,
population, percentage and spread printed in the same spacing as the header. Remember to print
to both the screen and the output file.
// Print county data table with headers, including state abbreviation, to screen and file
System.out.println(“nnCOVID-19 cases for selected counties”);
System.out.printf(“n%-18s%-4s%-8s%-8s%-12s%-6s%-20sn”,
“County”,”ST”,”Cases”,”Tests”,”Population”,”Rank”,”Percent Tested”);
//Print data
Print the header into the output file just like it is printed to the screen. Print a dashed line after
each header using the methods that are given. Then in a loop, print all the data from the county
arrays in a table. Each line of the table should have the county name, state abbreviation, number
of cases, number of tests, the county population, the county rank, and the percentage tested using
the same spacing as the header. Remember to print to both the screen and the output file.
Sample output:
COVID-19 cases for selected states
ST Cases
Population
Percent
Spread
——————————————————————–LA 21518
4648794
0.462873
Yes, widespread
TX 14624
28995881
0.050435
Yes, defined area(s)
COVID-19 cases for selected counties
County
ST Cases
Tests
Population Rank Percent Tested
——————————————————————–Tarrant
TX 929
6290
2092419
3
0.30060901
Jefferson
LA 5265
16504
435300
2
3.79140822
Sumner
TN 478
2279
179473
8
1.26982889
Jefferson
AL
645
6865
659892
1
1.04032175
Make sure that all output data is labeled so that a user would know what is represented by each
set of data shown in the output. Make sure that your program runs completely without errors and
the correct output is produced. Once your program is working correctly, save your working
program as XYZ1234Lab5Part1b.java and save the output file created by the program. [Dont
forget to put a note in your answer file for this question reminding the grader to look for the .java
file]
{27 points}
Rubric:
Use the given code {2pt}
Set up input file and scanner {2 pt}
The next section should read in data line by line from input file into the appropriate arrays {2 pt}
Inside the loop, read in a single line from the file and process that line {3 pts}
Inside the loop, determine line type by second element on the line {4 pts}
Inside the loop, lines with state level data are stored in st arrays {4 pts}
Inside the loop, lines with county level data are stored in co arrays {4 pts}
Print state data table with headers to screen and file {3 pts}
Print county data table with headers, including state abbreviation, to screen and file {3 pts}
1.b2) Take a screenshot of the complete output of your program XYZ1234Lab5Part1b.java with
the program output. Make sure …
Purchase answer to see full
attachment
We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.