Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- enum apple
- {McIntosh, Cosmic_Crisp, Red_Delicious, Golden_Delicious, Exit_Apples}
- public class apple_enum {
- public static void main(String[] args)
- {
- Scanner sc = new Scanner(System.in);
- while(true)
- {
- int c=1;
- System.out.println("The list of apples are:\n");
- for(apple i : apple.values())
- System.out.println(c++ + ". " +i);
- System.out.print("\nEnter your choice : ");
- int choice = sc.nextInt();
- apple a = apple.values()[choice - 1];
- switch(a)
- {
- case McIntosh:
- System.out.println("\n\n" + a + "\nThey are mild with a nice balance between sweet and tart. It’s not as firm as other varieties, which is why it’s best raw or chopped up into a salad or slaw.\n");
- break;
- case Cosmic_Crisp:
- System.out.println("\n\n"+ a + "\nThis apple is the remarkable result of 20 years of study and research by Washington State University’s world-class tree fruit breeding program. Classically bred and grown in Washington State\n");
- break;
- case Red_Delicious:
- System.out.println("\n\n"+ a + "\nThey have a super mild, simple flavor that doesn’t tend to stand out when cooked into dishes or used in pie. So, they’re best eaten as a snack all on their own.\n");
- break;
- case Golden_Delicious:
- System.out.println("\n\n"+ a + "\nUnrelated to the Red Delicious apple, Golden Delicious apples are soft with a thin skin. This is one variety you want to eat or freeze as soon as possible. \n");
- break;
- case Exit_Apples:
- return;
- default : continue;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement