Starting from:

$30

CS 565  Project #2 Analyzing Code Coverage -Solved  

 Part 1: 

Select any tool that provides statement and decision code coverage. Utilizing the 

VendingMachine.java code given to you, develop a set of test cases for your code based on the following requirements: 

•      Takes in an integer input 

•      Allows users to select between three products: Candy (20 cents), Coke (25 cents), Coffee (45 cents)  

•      Returns the selected product and any remaining change 

•      If there is not enough money to buy the product, displays the amount necessary to buy the product and other products to purchase. 

Execute the program with your test cases and observe the code coverage of your test cases. The goal is to reach 100% in both statement and decision coverage. 

 Part 2:  
Select any static source code analysis tool. The StaticAnalysis.java code given to yu contains two different data flow anomalies. Execute the tool on StaticAnalysis.java and identify what the two data flow anomalies are. The inputs are:  

•      the weight of the package as an integer 

•      the length of the package as an integer 

•      the type of product as a String 


More products