Answer:
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter a decimal value (0 to 15): ");
int num = scan.nextInt();
scan.close();
if (num < 0 || num >15) {
System.out.printf("%d is an invalid input\n", num);
} else {
System.out.printf("The hex value is %X\n", num);
}
}
}
Explanation:
Hopefully this example will get you going for the other assignments.
Answer:
To allow user to assign rating
Explanation:
The basic function of “rate” command is to give opportunity to the user to assign a value to a song from the range of 1 – 5.
In the range, the value of 1 indicates the lowest rating, while value of 5 is the highest rating that can be obtained.
Any previous ratings are then replaced by the new rating assigned from the range of 1 – 5.
Answer:
It happens to me as well. Maybe check emails? It could also be a bug.
Explanation:
Note:
% is Modulus,
So it's taken as num mod 7, if that evaluates to 0 there is no reminder therefore divisible by 7.