import java.util.Scanner;
// 1
class Main {
public static void main(String[] args) {
String framework = "%-15s%15s%15s%15s%15s%15s\n";
System.out.printf(framework,"","Monday", "Tuesday", "Wednesday", "Thursday",
"Friday");
System.out.printf(framework, "8:00AM - 9:15AM", "ENG101", "", "ENG101", "COL101", "");
System.out.printf(framework, "9:30AM - 11:50AM", "MAT141", "CSE121", "MAT141", "CSE121", "" );
System.out.printf(framework, "12:30AM - 1:45PM", "", "HIS101", "", "HIS101", "" );
System.out.printf(framework, "2:00PM - 2:55PM", "", "GYM", "", "GYM", "" );
}
public static void main[String[] args] {
}
}
// 2
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String format = "%-15s%15s%15s\n";
System.out.println("What is the resturant name: ");
String name = s.nextLine();
System.out.println("What is the resturant phone number: ");
String phoneNumber = s.nextLine();
System.out.println("What is dish 1: ");
String dish1 = s.nextLine();
System.out.println("What is the price: ");
Double price1 = s.nextDouble();
s.nextLine();
System.out.println("What is dish 2: ");
String dish2 = s.nextLine();
System.out.println("What is the price: ");
Double price2 = s.nextDouble();
s.nextLine();
System.out.println("What is dish 3: ");
String dish3 = s.nextLine();
System.out.println("What is the price: ");
Double price3 = s.nextDouble();
s.nextLine();
System.out.printf(format, "", name, "");
System.out.printf(format, "", phoneNumber, "");
System.out.printf(format, 1, dish1, price1);
System.out.printf(format, 2, dish2, price2);
System.out.printf(format, 3, dish3, price3);
}
}
// 3
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("What is todays weather conditon?");
String condition = s.nextLine();
System.out.println("What is the high of the tempuratute?");
Double high = s.nextDouble();
System.out.println("What is the low of the tempuratute?");
Double low = s.nextDouble();
System.out.printf("The weather is %s and the difference is %s", condition.toUpperCase(), high-low);
}
}
// 4
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter number of quarts");
int quarts = s.nextInt();
int gallons = quarts/4;
quarts %= 4;
System.out.printf("You need %d gallons and %d quarts", gallons, quarts);
}
}
// 5
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter number of miles");
int miles = s.nextInt();
System.out.printf("%d miles is %.2f km", miles, miles*1.60934);
}
}
// 6
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter number of eggs");
int eggs = s.nextInt();
System.out.printf("You ordered %d eggs. That is %d dozen at $3.25 per dozen and %d loose eggs at 45 cents each for a total of %.2f", eggs, eggs/12, eggs%12, (eggs/12 * 3.25) + (eggs%12 * .45));
}
}
// 7
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter number of adults");
int adults = s.nextInt();
System.out.println("Enter number of kids");
int kids = s.nextInt();
System.out.printf("For %d adults and %d kids your meal costs $%.2f", adults, kids, (adults*7 + kids*4) * 1.08625);
}
}
// 8
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter number of dollars");
int dollars = s.nextInt();
System.out.printf("100s:\t%d\n", dollars%100);
System.out.printf("50s:\t%d\n", dollars%50);
System.out.printf("20s:\t%d\n", dollars%20);
System.out.printf("10s:\t%d\n", dollars%10);
System.out.printf("5s:\t\t%d\n", dollars%5);
System.out.printf("1s:\t\t%d", dollars%1);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: