answersLogoWhite

0


Best Answer

This is not a question.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Discount program using java switch case?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you draw a flowchart using case statement?

double discount; // Usually code would be read in char code = 'B' ; switch ( code ) { case 'A': discount = 0.0; break; case 'B': discount = 0.1; break; case 'C': discount = 0.2; break; default: discount = 0.3; } System.out.println ( "discount is: " + discount );


Writ a program in c to display day of the week using in switch case?

/* write a program to print Days of Week using switch-case structure */ #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("\n Enter Day of weak as Number 1 to 7 "); scanf("%d",&n); switch(n) { case 1: printf("\n MONDAY "); case 2: printf("\n TUESDAY"); case 3: printf("\n WEDNESDAY"); case 4: printf("\n THURSDAY"); case 5: printf("\n FRIDAY"); case 6: printf("\n SATURDAY"); case 7: printf("\n SUNDAY"); default : printf("\n no operation is required"); } getch(); }


Using only one program implement bubble sorting insertion sorting quick sorting and selection sorting?

Its simple!dirve a menu based prog by using switch case & then apply every sorting function to it.


How do you break a loop in a switch case statement?

using break; statement


Write a java program using switch case to find zodiac signs?

Let's say you want a method which will determine if the given character is a vowel, consonant, or other (non-letter). // Will return a String representation of what the given character is: // "vowel" "consonant" or "other" public static final String getTypeOfChar(final char c) { // since chars are an integer data type in Java, we can switch on them switch(c) { case 'a': // all of these cases "fall through" to the next non-case statement case 'e': // if any of them matches case 'i': case 'o': case 'u': return "vowel"; case 'b': // again, all of these cases fall through case 'c': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'p': case 'q': case 'r': case 's': case 't': case 'v': case 'w': case 'x': case 'y': case 'z': return "consonant"; default: // if we have no matches yet, do this return "other"; } }

Related questions

How do you draw a flowchart using case statement?

double discount; // Usually code would be read in char code = 'B' ; switch ( code ) { case 'A': discount = 0.0; break; case 'B': discount = 0.1; break; case 'C': discount = 0.2; break; default: discount = 0.3; } System.out.println ( "discount is: " + discount );


I am using Borland C compiler and making a program using switch cases while loading program I'm getting error that case bypasses initialization of a local variable case 4?

You cannot declare variables inside a case label. Declare them outside of the switch.


What are the similarities between if else and switch case?

If else and switch case both are used to control the flow of program.


What is case in java?

Case is used to label each branch in the switch statement in Java Program


Writ a program in c to display day of the week using in switch case?

/* write a program to print Days of Week using switch-case structure */ #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("\n Enter Day of weak as Number 1 to 7 "); scanf("%d",&n); switch(n) { case 1: printf("\n MONDAY "); case 2: printf("\n TUESDAY"); case 3: printf("\n WEDNESDAY"); case 4: printf("\n THURSDAY"); case 5: printf("\n FRIDAY"); case 6: printf("\n SATURDAY"); case 7: printf("\n SUNDAY"); default : printf("\n no operation is required"); } getch(); }


Using only one program implement bubble sorting insertion sorting quick sorting and selection sorting?

Its simple!dirve a menu based prog by using switch case & then apply every sorting function to it.


How do you break a loop in a switch case statement?

using break; statement


How do you write coding php using switch case?

The case structure in PHP uses the following syntax: switch($foo){ case 'bar': doSomething(); break; case 'blah': doSomethingElse(); break; default: handleOtherCases(); }


Write a program in C to check whether a given number is odd or even using switch statement?

#include<stdio.h> #include<conio.h> void main() { int n; printf("please enter number \n"); scanf("%d",n); switch(n%2) { case 0 : printf("even"); break; case 1 : case -1 : printf("odd"); } getch(); }


Write a java program using switch case to find zodiac signs?

Let's say you want a method which will determine if the given character is a vowel, consonant, or other (non-letter). // Will return a String representation of what the given character is: // "vowel" "consonant" or "other" public static final String getTypeOfChar(final char c) { // since chars are an integer data type in Java, we can switch on them switch(c) { case 'a': // all of these cases "fall through" to the next non-case statement case 'e': // if any of them matches case 'i': case 'o': case 'u': return "vowel"; case 'b': // again, all of these cases fall through case 'c': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'p': case 'q': case 'r': case 's': case 't': case 'v': case 'w': case 'x': case 'y': case 'z': return "consonant"; default: // if we have no matches yet, do this return "other"; } }


How does the case statement work in c?

prog1: #include<stdio.h> int main() { switch(1) { int i=0; case 1:printf("%d",i); } getchar(); return 0; } Output: garbage value. prog2: #include<stdio.h> int main() { switch(1) { printf("Inside Switch"); case 1:printf("Case 1\n"); } printf("Outside Switch"); getchar(); return 0; } Output: Case 1 Outside Switch. The statements before a case labelled statement seem unreachable according to program 2 but then why don't i get an error for an undeclared variable i in the first program (only a warning). Would be really helpful if someone could explain in detail that how the switch statement is treated internally.


How to write C program without operater?

// a complete C program without using any operators int main() { return 0; } // a non-useless program, which accepts a single command line argument and // prints whether or not the first character is a vowel int main(int argc, char** argv) { if(argc != 2) { return 1; } switch(argv[1][0]) { case 'a': case 'e': case 'i': case 'o': case 'u': printf("vowel\n"); break; default: printf("not vowel\n"); } return 0; }