Reference no: EM132217615
1. What would be the value of discountRate after the following statements are executed?
double discountRate;
char custType = 'B';
switch (custType)
{
case 'A': discountRate = 0.08;
break;
case 'B': discountRate = 0.06;
case 'C': discountRate = 0.04;
default: discountRate = 0.0;
}
A) 0.08
B) 0.06
C) 0.04
D) 0.02.
2. What does the following code do?
Scanner keyboard = new Scanner(System.in);
String filename;
System.out.print("Enter the filename: ");
filename = keyboard.readString();
PrintWriter outFile = new PrintWriter(filename);
A) It writes to a file named filename.
B) It allows the user to enter the name of the file that data will to be written to.
C) It establishes a connection with a file named filename.
D) Nothing. The code contains a syntax error.