SlideShare a Scribd company logo
1 of 44
Debug and Fix If Statements
In this assessment, you will debug and fix a given Java console
application that uses if statements,
but the application does not compile nor execute. You can use
either the Toolwire environment or
your local Java development environment to complete this
assignment.
The application has four bugs. Your assignment is to find these
bugs and fix them so that the
application meets its stated requirements.
The requirements of this application are as follows: The
application is to prompt the user to enter 3
integers representing three choices of numbers between 1 and 7.
An integer value of zero means a
choice has not been made yet.
The application then determines and prints out the state of the
choices made. That is the
application determines and prints out the number of choices
made and their values.
The three choices have restrictions on them based on their
order. The choices are made in order
such that if the user did not make a first choice of a number
between 1 and 7 (first integer is zero),
the user cannot make a second or a third choice. An example of
the three integers in this case
would be:
0 0 0
Similarly, if the user makes a first choice (first integer is non-
zero), but did not make a second
choice (second integer is zero), the user cannot make a third
choice. An example of the three
integers in this case would be:
2 0 0
and so on.
There is no need to validate the entered three integers to ensure
they comply with the above rules.
(Choices are between 1 and 7 and are entered in order.) Assume
the entered data will be valid.
Use these valid sets of data for testing: 0 0 0
2 0 0
1 4 0
7 5 7
Successful completion of this assignment will show the number
of non-zero choices made by the user
and their values when the application is run. Your program
output should look like this sample output:
Follow these steps to complete this assignment:
1. Unzip the attached NetBeans project zip file
(U3A1_DebugFixIFStmts.zip) and load it into
your NetBeans IDE.
2. Debug and fix the application to meet its stated requirements.
3. Compile and test your application using the provided input
data.
Make sure to document the result of your testing by taking
screenshots of the result of
running your application similar to the provided sample output.
Four screenshots are
required for this assignment.
Explain the approach you took to complete this assignment and
the major decisions you made. As
part of your explanation, be sure to identify the fundamental
Java constructs you used that were
specific and relevant to your submitted program.
5
Deliverables
Use the submission template provided in the resources
(WeekX
Solution
SubmissionTemplate.docx) to complete and submit your
deliverables. Your
deliverables in the attached submission template should include:
1. Your work. (Netbeans project zip file + copy of *.java source
code.)
2. Screenshots of the result of testing your application. See the
examples provided.
3. Explain the approach you took to complete this assignment
and the major decisions you
made. As part of your explanation, be sure to identify the
fundamental Java constructs
you used that were specific and relevant to your submitted
program.
Your work will be scored on the following criteria:
1. Identify bugs in a program using development tools.
2. Code an application to fix bugs.
3. Test the application and document testing.
4. Explain the approach taken to complete the fix and the major
decisions made.
5. Identify relevant fundamental constructs in submitted
program.
6. Communicate efficiently, effectively, and in an appropriate
manner as an IT professional.
Debug and Fix If StatementsDeliverables
U3A1_DebugFixIFStmts/build.xml
Builds, tests, and runs the project U3A1_DebugFixIFStmts.
U3A1_DebugFixIFStmts/build/classes/.netbeans_automatic_buil
d
U3A1_DebugFixIFStmts/build/classes/.netbeans_update_resourc
es
U3A1_DebugFixIFStmts/build/classes/u3a1_debugfixifstmts/U3
A1_DebugFixIFStmts.classpackage u3a1_debugfixifstmts;
publicsynchronizedclass U3A1_DebugFixIFStmts {
public void U3A1_DebugFixIFStmts();
publicstatic void main(String[]);
}
U3A1_DebugFixIFStmts/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
U3A1_DebugFixIFStmts/nbproject/build-impl.xml
Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar
Must set javac.includes
No tests executed.
Must set JVM to use for profiling in profiler.info.jvm
Must set profiler agent JVM arguments in
profiler.info.jvmargs.agent
U3A1_DebugFixIFStmts/nbproject/genfiles.properties
build.xml.data.CRC32=bb39b23f
build.xml.script.CRC32=aa413d5d
[email protected]
# This file is used by a NetBeans-based IDE to track changes in
generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will
never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=bb39b23f
nbproject/build-impl.xml.script.CRC32=417e31dc
nbproject/[email protected]
U3A1_DebugFixIFStmts/nbproject/private/private.properties
compile.on.save=true
user.properties.file=C:UsersomoraAppDataRoamingNetB
eans8.1build.properties
U3A1_DebugFixIFStmts/nbproject/private/private.xml
U3A1_DebugFixIFStmts/nbproject/project.properties
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.
dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection
transport:
#debug.transport=dt_socket
debug.classpath=
${run.classpath}
debug.test.classpath=
${run.test.classpath}
# Files in build.classes.dir which should be excluded from
distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/U3A1_DebugFixIFStmts.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=
${javac.classpath}:
${build.classes.dir}
javac.test.processorpath=
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=u3a1_debugfixifstmts.U3A1_DebugFixIFStmts
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=
${javac.classpath}:
${build.classes.dir}
# Space-separated list of JVM arguments used when running the
project.
# You may also define separate properties like run-sys-
prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-
prop.name=value:
run.jvmargs=
run.test.classpath=
${javac.test.classpath}:
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
U3A1_DebugFixIFStmts/nbproject/project.xml
org.netbeans.modules.java.j2seproject
U3A1_DebugFixIFStmts
U3A1_DebugFixIFStmts/src/u3a1_debugfixifstmts/U3A1_Debu
gFixIFStmts.javaU3A1_DebugFixIFStmts/src/u3a1_debugfixifst
mts/U3A1_DebugFixIFStmts.java/*
* To change this license header, choose License Headers in Pro
ject Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package u3a1_debugfixifstmts;
import java.util.Scanner;
/**
*
* @author omora
*/
publicclassU3A1_DebugFixIFStmts{
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
// TODO code application logic here
System.out.println("Teacher's Copy");
Scanner input =newScanner(System.in);
// prompt the user to enter 3 ints
// and read them into
// firstChoice
//secondChoice
//thirdChoice
System.out.print("Enter three integers: ");
int firstChoice = input.nextInt();
int secondChoice = input.nextInt();
int thirdChoice = input.nextInt();
//Determine & print the state of choices made
if(firstChoice ==0)
System.out.println("State of choices: n"+
"no choices made yet");
if(secondChoice ==0)
System.out.println("State of choices: n"+
"user made first choice ("+ firstChoice +")n"+
"number of choices = 1");
elseif(thirdChoice =0)
System.out.println("State of choices: n"+
"user made first choice ("+ firstChoice +")n"+
"user made second choice ("+ secondChoice +")n"+
"number of choices = 2");
System.out.println("State of choices: n"+
"user made first choice ("+ firstChoice +")n"+
"user made second choice ("+ secondChoice +")n"+
"user made third choice ("+ thirdChoice +")n"+
"number of choices = 3")
}
}
Remove or Replace: Header Is Not Doc Title
Name:
Date:
Class: IT2249
Unit:
Insert here a copy of your zip file of all of your NetBeans
project files so that it could be unzipped, loaded and run in
another NetBeans:
Insert here a copy of your *.java source code text that you used
here (copy and paste source code here, do not simply insert
*.java files):
Insert here a screenshot showing the result of testing your
application as directed by the assignment:
Explain your approach you took to complete this assignment
and the major decisions you made:
1
2

More Related Content

Similar to Debug and Fix If Statements In this assessment, you will d.docx

Manual testing real time questions by subbu
Manual testing real time questions by subbuManual testing real time questions by subbu
Manual testing real time questions by subbu
palla subrahmanyam
 
52892006 manual-testing-real-time
52892006 manual-testing-real-time52892006 manual-testing-real-time
52892006 manual-testing-real-time
Sunil Pandey
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
Nishant Worah
 
software testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblbsoftware testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblb
jeyasrig
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
comp274
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
helpido9
 
Learn software testing with tech partnerz 3
Learn software testing with tech partnerz 3Learn software testing with tech partnerz 3
Learn software testing with tech partnerz 3
Techpartnerz
 
Sdd Testing & Evaluating
Sdd Testing & EvaluatingSdd Testing & Evaluating
Sdd Testing & Evaluating
mary_ramsay
 

Similar to Debug and Fix If Statements In this assessment, you will d.docx (20)

Unit1
Unit1Unit1
Unit1
 
Manual testing real time questions by subbu
Manual testing real time questions by subbuManual testing real time questions by subbu
Manual testing real time questions by subbu
 
52892006 manual-testing-real-time
52892006 manual-testing-real-time52892006 manual-testing-real-time
52892006 manual-testing-real-time
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
 
Manual testing visonia
Manual testing   visoniaManual testing   visonia
Manual testing visonia
 
Testing level
Testing levelTesting level
Testing level
 
software testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblbsoftware testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblb
 
Software testing for biginners
Software testing for biginnersSoftware testing for biginners
Software testing for biginners
 
Some Commonly Asked Question For Software Testing
Some Commonly Asked Question For Software TestingSome Commonly Asked Question For Software Testing
Some Commonly Asked Question For Software Testing
 
Software testing introduction
Software testing introductionSoftware testing introduction
Software testing introduction
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Learn software testing with tech partnerz 3
Learn software testing with tech partnerz 3Learn software testing with tech partnerz 3
Learn software testing with tech partnerz 3
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
 
Software testing
Software testingSoftware testing
Software testing
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
 
Sdd Testing & Evaluating
Sdd Testing & EvaluatingSdd Testing & Evaluating
Sdd Testing & Evaluating
 
What is integration testing
What is integration testingWhat is integration testing
What is integration testing
 

More from edwardmarivel

Deadline 6 PM Friday September 27, 201310 Project Management Que.docx
Deadline 6 PM Friday September 27, 201310 Project Management Que.docxDeadline 6 PM Friday September 27, 201310 Project Management Que.docx
Deadline 6 PM Friday September 27, 201310 Project Management Que.docx
edwardmarivel
 
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docxDEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
edwardmarivel
 
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docxDe nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
edwardmarivel
 
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docxDDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
edwardmarivel
 
ddr-.docx
ddr-.docxddr-.docx
ddr-.docx
edwardmarivel
 
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docxDDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
edwardmarivel
 
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docxDBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
edwardmarivel
 
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docxDBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
edwardmarivel
 
DB Response 1I agree with the decision to search the house. Ther.docx
DB Response 1I agree with the decision to search the house. Ther.docxDB Response 1I agree with the decision to search the house. Ther.docx
DB Response 1I agree with the decision to search the house. Ther.docx
edwardmarivel
 
DB Response prompt ZAKChapter 7, Q1.Customers are expecting.docx
DB Response prompt  ZAKChapter 7, Q1.Customers are expecting.docxDB Response prompt  ZAKChapter 7, Q1.Customers are expecting.docx
DB Response prompt ZAKChapter 7, Q1.Customers are expecting.docx
edwardmarivel
 
DB Topic of Discussion Information-related CapabilitiesAnalyze .docx
DB Topic of Discussion Information-related CapabilitiesAnalyze .docxDB Topic of Discussion Information-related CapabilitiesAnalyze .docx
DB Topic of Discussion Information-related CapabilitiesAnalyze .docx
edwardmarivel
 
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docxDAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
edwardmarivel
 

More from edwardmarivel (20)

deadline 6 hours 7.3 y 7.47.4.docx
deadline  6 hours 7.3 y 7.47.4.docxdeadline  6 hours 7.3 y 7.47.4.docx
deadline 6 hours 7.3 y 7.47.4.docx
 
Deadline 6 PM Friday September 27, 201310 Project Management Que.docx
Deadline 6 PM Friday September 27, 201310 Project Management Que.docxDeadline 6 PM Friday September 27, 201310 Project Management Que.docx
Deadline 6 PM Friday September 27, 201310 Project Management Que.docx
 
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docxDEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
DEADLINE 15 HOURS6 PAGES UNDERGRADUATECOURSEWORKHARV.docx
 
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docxDe nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
De nada.El gusto es mío.Encantada.Me llamo Pepe.Muy bien, grac.docx
 
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docxDDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
DDBA 8307 Week 4 Assignment TemplateJohn DoeDDBA 8.docx
 
DDL 24 hours reading the article and writing a 1-page doubl.docx
DDL 24 hours reading the article and writing a 1-page doubl.docxDDL 24 hours reading the article and writing a 1-page doubl.docx
DDL 24 hours reading the article and writing a 1-page doubl.docx
 
DCF valuation methodSuper-normal growth modelApplicatio.docx
DCF valuation methodSuper-normal growth modelApplicatio.docxDCF valuation methodSuper-normal growth modelApplicatio.docx
DCF valuation methodSuper-normal growth modelApplicatio.docx
 
ddr-.docx
ddr-.docxddr-.docx
ddr-.docx
 
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docxDDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
DDBA 8307 Week 2 Assignment ExemplarJohn Doe[footnoteRef1] .docx
 
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docxDBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
DBM380 v14Create a DatabaseDBM380 v14Page 2 of 2Create a D.docx
 
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docxDBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
DBA CAPSTONE TEMPLATEThe pages in this template are correctl.docx
 
DB3.1 Mexico corruptionDiscuss the connection between pol.docx
DB3.1 Mexico corruptionDiscuss the connection between pol.docxDB3.1 Mexico corruptionDiscuss the connection between pol.docx
DB3.1 Mexico corruptionDiscuss the connection between pol.docx
 
DB2Pepsi Co and Coke American beverage giants, must adhere to th.docx
DB2Pepsi Co and Coke American beverage giants, must adhere to th.docxDB2Pepsi Co and Coke American beverage giants, must adhere to th.docx
DB2Pepsi Co and Coke American beverage giants, must adhere to th.docx
 
DB1 What Ive observedHave you ever experienced a self-managed .docx
DB1 What Ive observedHave you ever experienced a self-managed .docxDB1 What Ive observedHave you ever experienced a self-managed .docx
DB1 What Ive observedHave you ever experienced a self-managed .docx
 
DB Response 1I agree with the decision to search the house. Ther.docx
DB Response 1I agree with the decision to search the house. Ther.docxDB Response 1I agree with the decision to search the house. Ther.docx
DB Response 1I agree with the decision to search the house. Ther.docx
 
DB Response prompt ZAKChapter 7, Q1.Customers are expecting.docx
DB Response prompt  ZAKChapter 7, Q1.Customers are expecting.docxDB Response prompt  ZAKChapter 7, Q1.Customers are expecting.docx
DB Response prompt ZAKChapter 7, Q1.Customers are expecting.docx
 
DB Topic of Discussion Information-related CapabilitiesAnalyze .docx
DB Topic of Discussion Information-related CapabilitiesAnalyze .docxDB Topic of Discussion Information-related CapabilitiesAnalyze .docx
DB Topic of Discussion Information-related CapabilitiesAnalyze .docx
 
DB Instructions Each reply must be 250–300 words with a minim.docx
DB Instructions Each reply must be 250–300 words with a minim.docxDB Instructions Each reply must be 250–300 words with a minim.docx
DB Instructions Each reply must be 250–300 words with a minim.docx
 
DB Defining White Collar CrimeHow would you define white co.docx
DB Defining White Collar CrimeHow would you define white co.docxDB Defining White Collar CrimeHow would you define white co.docx
DB Defining White Collar CrimeHow would you define white co.docx
 
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docxDAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
DAVID H. ROSENBLOOMSECOND EDITIONAdministrative Law .docx
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

Debug and Fix If Statements In this assessment, you will d.docx

  • 1. Debug and Fix If Statements In this assessment, you will debug and fix a given Java console application that uses if statements, but the application does not compile nor execute. You can use either the Toolwire environment or your local Java development environment to complete this assignment. The application has four bugs. Your assignment is to find these bugs and fix them so that the application meets its stated requirements. The requirements of this application are as follows: The application is to prompt the user to enter 3 integers representing three choices of numbers between 1 and 7. An integer value of zero means a choice has not been made yet. The application then determines and prints out the state of the choices made. That is the application determines and prints out the number of choices made and their values. The three choices have restrictions on them based on their order. The choices are made in order such that if the user did not make a first choice of a number between 1 and 7 (first integer is zero), the user cannot make a second or a third choice. An example of the three integers in this case would be:
  • 2. 0 0 0 Similarly, if the user makes a first choice (first integer is non- zero), but did not make a second choice (second integer is zero), the user cannot make a third choice. An example of the three integers in this case would be: 2 0 0 and so on. There is no need to validate the entered three integers to ensure they comply with the above rules. (Choices are between 1 and 7 and are entered in order.) Assume the entered data will be valid. Use these valid sets of data for testing: 0 0 0 2 0 0 1 4 0 7 5 7 Successful completion of this assignment will show the number of non-zero choices made by the user
  • 3. and their values when the application is run. Your program output should look like this sample output: Follow these steps to complete this assignment: 1. Unzip the attached NetBeans project zip file (U3A1_DebugFixIFStmts.zip) and load it into your NetBeans IDE. 2. Debug and fix the application to meet its stated requirements. 3. Compile and test your application using the provided input data. Make sure to document the result of your testing by taking screenshots of the result of running your application similar to the provided sample output. Four screenshots are
  • 4. required for this assignment. Explain the approach you took to complete this assignment and the major decisions you made. As part of your explanation, be sure to identify the fundamental Java constructs you used that were specific and relevant to your submitted program. 5 Deliverables Use the submission template provided in the resources (WeekX Solution SubmissionTemplate.docx) to complete and submit your deliverables. Your deliverables in the attached submission template should include: 1. Your work. (Netbeans project zip file + copy of *.java source code.) 2. Screenshots of the result of testing your application. See the examples provided.
  • 5. 3. Explain the approach you took to complete this assignment and the major decisions you made. As part of your explanation, be sure to identify the fundamental Java constructs you used that were specific and relevant to your submitted program. Your work will be scored on the following criteria: 1. Identify bugs in a program using development tools. 2. Code an application to fix bugs. 3. Test the application and document testing. 4. Explain the approach taken to complete the fix and the major decisions made. 5. Identify relevant fundamental constructs in submitted program. 6. Communicate efficiently, effectively, and in an appropriate manner as an IT professional.
  • 6. Debug and Fix If StatementsDeliverables U3A1_DebugFixIFStmts/build.xml Builds, tests, and runs the project U3A1_DebugFixIFStmts. U3A1_DebugFixIFStmts/build/classes/.netbeans_automatic_buil d U3A1_DebugFixIFStmts/build/classes/.netbeans_update_resourc es U3A1_DebugFixIFStmts/build/classes/u3a1_debugfixifstmts/U3 A1_DebugFixIFStmts.classpackage u3a1_debugfixifstmts; publicsynchronizedclass U3A1_DebugFixIFStmts { public void U3A1_DebugFixIFStmts(); publicstatic void main(String[]); } U3A1_DebugFixIFStmts/manifest.mf
  • 7. Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build U3A1_DebugFixIFStmts/nbproject/build-impl.xml Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar
  • 8.
  • 9.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. U3A1_DebugFixIFStmts/nbproject/genfiles.properties build.xml.data.CRC32=bb39b23f build.xml.script.CRC32=aa413d5d [email protected] # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=bb39b23f nbproject/build-impl.xml.script.CRC32=417e31dc nbproject/[email protected] U3A1_DebugFixIFStmts/nbproject/private/private.properties
  • 34. build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results # Uncomment to specify the preferred debugger connection transport: #debug.transport=dt_socket debug.classpath=
  • 35. ${run.classpath} debug.test.classpath= ${run.test.classpath} # Files in build.classes.dir which should be excluded from distribution jar dist.archive.excludes= # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/U3A1_DebugFixIFStmts.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= includes=** jar.compress=false
  • 36. javac.classpath= # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.external.vm=true javac.processorpath= ${javac.classpath} javac.source=1.8 javac.target=1.8 javac.test.classpath= ${javac.classpath}: ${build.classes.dir} javac.test.processorpath=
  • 38. main.class=u3a1_debugfixifstmts.U3A1_DebugFixIFStmts manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform run.classpath= ${javac.classpath}: ${build.classes.dir} # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys- prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys- prop.name=value:
  • 40. U3A1_DebugFixIFStmts/src/u3a1_debugfixifstmts/U3A1_Debu gFixIFStmts.javaU3A1_DebugFixIFStmts/src/u3a1_debugfixifst mts/U3A1_DebugFixIFStmts.java/* * To change this license header, choose License Headers in Pro ject Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package u3a1_debugfixifstmts; import java.util.Scanner; /** * * @author omora */ publicclassU3A1_DebugFixIFStmts{
  • 41. /** * @param args the command line arguments */ publicstaticvoid main(String[] args){ // TODO code application logic here System.out.println("Teacher's Copy"); Scanner input =newScanner(System.in); // prompt the user to enter 3 ints // and read them into // firstChoice //secondChoice //thirdChoice System.out.print("Enter three integers: "); int firstChoice = input.nextInt(); int secondChoice = input.nextInt(); int thirdChoice = input.nextInt(); //Determine & print the state of choices made if(firstChoice ==0) System.out.println("State of choices: n"+ "no choices made yet"); if(secondChoice ==0)
  • 42. System.out.println("State of choices: n"+ "user made first choice ("+ firstChoice +")n"+ "number of choices = 1"); elseif(thirdChoice =0) System.out.println("State of choices: n"+ "user made first choice ("+ firstChoice +")n"+ "user made second choice ("+ secondChoice +")n"+ "number of choices = 2"); System.out.println("State of choices: n"+ "user made first choice ("+ firstChoice +")n"+ "user made second choice ("+ secondChoice +")n"+ "user made third choice ("+ thirdChoice +")n"+ "number of choices = 3") } } Remove or Replace: Header Is Not Doc Title Name: Date: Class: IT2249 Unit:
  • 43. Insert here a copy of your zip file of all of your NetBeans project files so that it could be unzipped, loaded and run in another NetBeans: Insert here a copy of your *.java source code text that you used here (copy and paste source code here, do not simply insert *.java files): Insert here a screenshot showing the result of testing your application as directed by the assignment: Explain your approach you took to complete this assignment and the major decisions you made:
  • 44. 1 2