The Downdog Yoga Studio offers five types of classes as show
The Downdog Yoga Studio offers five types of classes, as shown in Table 6-2. Design a program that accepts a number representing a class and then displays the name of the class.
Solution
import java.util.*;
class YogaStudio
{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println(\"Enter the class number between 1 and 5\");
int classnum=sc.nextInt();
String CLASSNAME[] = {\"Yoga 1\",\"Yoga 2\",\"Childrens Yoga\",\"Prenatal Yoga\",\"Senior Yoga\" };
if(classnum <1 | classnum >5)
System.out.println(\"Invalid Input\");
else
System.out.println(\"The class name of class \"+ classnum + \" is\"+CLASSNAME[classnum-1]);
}
}
