Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
Compute the average kids per family
Compute the average kids per family. Note that the integers should be type cast to doubles.
import java.util.Scanner; public class TypeCasting { public static void main (String [] args) { int numKidsA = 1; int numKidsB = 4; int numKidsC = 5; int numFamilies = 3; double avgKids = 0.0; System.out.print("Average kids per family: "); System.out.println(avgKids); return; } }
i can't figure it out
Expert Solution
TypeCasting.java
import java.util.Scanner;
public class TypeCasting {
public static void main(String[] args) {
int numKidsA = 1;
int numKidsB = 4;
int numKidsC = 5;
int numFamilies = 3;
double avgKids = 0.0;
avgKids = (numKidsA + numKidsB + numKidsC) /(double)numFamilies;
System.out.print("Average kids per family: ");
System.out.println(avgKids);
return;
}
}
Output:
Average kids per family: 3.3333333333333335
Archived Solution
You have full access to this solution. To save a copy with all formatting and attachments, use the button below.
For ready-to-submit work, please order a fresh solution below.





