CHALLENGE 2.22.1: Type casting: Computing average kids per family ACTIVITY Compute the average kids per family. Note tha

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

Challenge 2 22 1 Type Casting Computing Average Kids Per Family Activity Compute The Average Kids Per Family Note Tha 1
Challenge 2 22 1 Type Casting Computing Average Kids Per Family Activity Compute The Average Kids Per Family Note Tha 1 (61.27 KiB) Viewed 22 times
import java.util.Scanner;
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?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply