Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

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); } }

image text in transcribed

import java.util.Scanner;

public class TicketCounter { public static void main (String [] args) { int awardPoints; int userTickets;

Scanner scnr = new Scanner(System.in); userTickets = scnr.nextInt(); // Program will be tested with values: 5, 6, 7, 8.

/* Your code goes here */

System.out.println(awardPoints); } }image text in transcribed

Compute the average kids per family. Note that the integers should be type cast to doubles. 1 test passed All tests passed 1 import java.util.Scanner; 2 3 public class TypeCasting { 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 int numKidsA; 7 int numKidsB; 8 int numKidsC; 9 int numFamilies; 10 double avgKids; 11 12 numKidsA = scnr.nextInt(); 13 numKidsB = scnr.nextInt(); 14 numKidsC = scnr.nextInt(); 15 numFamilies scnr.nextInt(); 16 17 /* Your solution goes here */ 18 Write an if-else statement for the following: If userTickets is less than 7, execute award Points = 1. Else, execute award Points = userTickets. 2 Ex: If userTickets is 3, then award Points = 1. 1 import java.util.Scanner; 2 3 public class TicketCounter { 4 public static void main (String [] args) { 5 int awardpoints; int userTickets; Scanner scnr = new Scanner(System.in); userTickets scnr.nextInt(); // Program will be tested with values: 5, 6, 7, 8. /* Your code goes here */ 8 9 10 11 12 13 14 15 } System.out.println(awardpoints); } 1 2. Check Next

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

What is the general part of the criminal law? Provide an example.

Answered: 1 week ago