CHALLENGE 2.22.1: Type casting: Computing average kids per family ACTIVITY Compute the average kids per family. Note tha
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
CHALLENGE 2.22.1: Type casting: Computing average kids per family ACTIVITY Compute the average kids per family. Note tha
public class TypeCasting { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numKidsA; int numKidsB; int numKidsC; int numFamilies; double avgKids;
numKidsA = scnr.nextInt(); numKidsB = scnr.nextInt(); numKidsC = scnr.nextInt(); numFamilies = scnr.nextInt();
/* Your solution goes here */
System.out.println(avgKids); }}
CHALLENGE 2.22.1: Type casting: Computing average kids per family ACTIVITY Compute the average kids per family. Note that the integers should be type cast to doubles. 417856.2527814.qx3zqy7 6 7 8 9 18123415 16 17 18 19 28 21 10 20 } 21 } Run int numKidsA; int numKidsB; int numKidsC; int numFamilies; double avgKids; numKidsA scnr.nextInt(); numKidsB scnr.nextInt(); numKidsC scnr.nextInt(); numFamilies scnr.nextInt(); /* Your solution goes here */ System.out.println(avgKids); Doll 1 test passed All tests passed Feedback?