Question: solve Auto-graded programming assignments may use a Unit lest to test small parts of a program. Unlike a Compare output lest, which evaluates your program's

solve

Auto-graded programming assignments may use a Unit lest to test small parts of a program. Unlike a Compare output lest, which evaluates your program's outpul for specific input values, a Unit fest evaluates individual methods to determines if each method "is named correctly and has the correct parameters and relum type calculates and relums the correct value (or prints the correct output) This example lab uses mulliple unit tests to lest the kilToPounds() function. Complete a program that takes a weight in kilograms as input, converts the weight to pounds, and then outputs the weight in pounds. 1 kilogram = 2 204 pounds (Ibs) Ex: If the inpul is: 10 The output is 22 . 040000080000003 1ba Note Your program must deline the method public static double kiloToPounds [double kilos) The program below has an error in the kiloToPounds() method. 1. Try submilling the program for grading (dick "Submit mode". then "Submit for grading"). Notice that the first two test cases fail, but The third test case passes The first test case fails because the program outputs the result from the kiloToPounds() function, which has an error. The second lest case uses a Unit test to lest the kloToPounds() function, which fails. 2. Charge the kiloToPounds() method to multiply the variable kilas by 2 204, instead of dividing. The return statement should be saturn (kilos * 2.204) , Submit again. Now the test cases should all pass. Nole A common emr is to mistype a function name with the incorrect capitalization. Function names are case sensitive, so if a lab program asks for a kiloToPounds() function, a KiloToPounds() function that works for you in develop mode will result in a failed unit lest (the unit test will not be able to find kilo ToPounds()). ACTIVITY 5.25.1: Lab training: Unit tests to evaluate your program 0/3 Main.java Load default template.. import java. util.Scanner ; public class Main [ public static double kiloToPounds (double kilos) [ // This statement intentionally has an error. return (kilos / 2.284); 18 public static void main(String[ ] args) { 11 Scanner sene = now Scanner (System. im) ; 12 13 double kilos; 14 double pounds; 15 16 kilos = sen.nextDouble (); 17 pounds = kiloTorounds (kilos)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!