Question: Integers numberOfPieces, allowedGroups, and invalidGroups are read from input. If numberOfPieces is less than 2 3 , then add 5 to allowedGroups. Otherwise, subtract 1

Integers numberOfPieces, allowedGroups, and invalidGroups are read from input. If numberOfPieces is less than 23, then add 5 to allowedGroups. Otherwise, subtract 1 from invalidGroups. import java.util.Scanner;
public class GroupStudy {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int numberOfPieces;
int allowedGroups;
int invalidGroups;
numberOfPieces = scnr.nextInt();
allowedGroups = scnr.nextInt();
invalidGroups = scnr.nextInt();
/* Your code goes here */
System.out.println(allowedGroups);
System.out.println(invalidGroups);
}
}

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 Databases Questions!