Imagine if you were given candies to divide evenly between t…

Imagine if you were given candies to divide evenly between the members of your group of 4. You should follow kindergarten rules, where everyone in the group should get the same number, and any extras should be returned to the teacher.If your group of 4 received 11 candies, how many candies are left over to be returned to your teacher?

The following code segment is intended to print the total co…

The following code segment is intended to print the total cost of a stay in a room at a particular hotel. The int variable numNights represents the length of the stay, in nights, and the double variable dailyRate represents the room base cost for each night of the stay. For stays that are longer than five nights, there is a 10% discount applied to the room base cost for all nights during the stay. In addition to the room cost, the hotel charges a $25 resort fee for each night of the stay. The resort fee is not eligible for the 10% discount for stays that are longer than five nights.   int numNights = /* some initial value */ ; double dailyRate = /* some initial value */ ; double totalCost = numNights * dailyRate;/* missing code */ System.out.println(totalCost);    Which of the following can be used to replace /* missing code */ so that the code segment works as intended?

Consider the following code segment. Assume that the int var…

Consider the following code segment. Assume that the int variable input has been properly declared and initialized.   int answer = 1; if (input != 0){ int count = 1; while (count != input){ count++; answer *= count; }}System.out.println(answer);   Which of the following best describes the condition in which this code segment always results in integer overflow?