Yeah, the program works perfectly fine now.
Type: Posts; User: javaBoi
Yeah, the program works perfectly fine now.
Oh no, I needed the question in program (but not in the place I initially had it). Sorry for not being clear from the start.
It is, right? The program does ask for the service package first, then the number of hours used..Or is the program written in the wrong order in terms of execution of the statements?
public...
import java.util.Scanner;
public class internetPackage
{
public static void main(String[] args)
{
String input;
char servicePackage;
int hoursUsed, regularHours, extraHours;...
Nope, still gives me the same output, actually..
I wanted to do that, but how would I write it?
Would this work?
If (servicePackage != 'A' && servicePackage != 'a' && servicePackage != 'B' && servicePackage != 'b' && servicePackage != 'C' &&...
Oh, sorry. In my previous post, I actually mentioned that I took that "Invalid input. Hours cannot be negative." statement from it's original position and placed it as an ELSE statement for each...
Whoops, my bad. It's under "Default." Towards the end of the program.
For Switch Statements, "Default" acts like an "Else" incase the conditions being tested are all false, right?
...
Okay, I was able to resolve the "Invalid input. Hours cannot be negative" by placing if (hoursUsed < 0) System.out.println("Invalid input. Hours cannot be negative."); into each switch.
I'm still...
Hi everyone, first time entry. I have a problem with my java program output. It looks like the program logic is correct, but there are still some line of statements that are executed that I do not...