Computer Science, asked by ankitssm244, 1 year ago

Estimated End Date: 31/01/19
X
Question: Tiktok v2
You have recently seen a motivational sports movie and want to start exercising regularly. Your coach tells you that it is important to get up early in the morning to exercise. She sets up a schedule for you:

On weekdays (Monday - Friday), you have to get up at 5:00. On weekends (Saturday & Sunday), you can wake up at 6:00. However, if you are on vacation, then you can get up at 7:00 on weekdays and 9:00 on weekends.

Write a program to print the time you should get up.

Input Format

The first line contains n - the number of inputs.
Following that are n lines, each containing an integer and a boolean value.

The integer tells you the day it is (1-Sunday, 2-Monday, 3-Tuesday, 4-Wednesday, 5-Thursday, 6-Friday, 7-Saturday). The boolean is true if you are on vacation and false if you’re not on vacation.

You have to print the time you should get up.

Use the System.out.println() statement for printing.

Answers

Answered by nitish8089
2
import java.util.Scanner;
public class Program
{
public static void met(int days, boolean vacation){
if(vacation){
if(days>=2&&days<=6){
System.out.println("7:00");
}
else{
System.out.println("9:00");
}
}
else {
if(days>=2&&days<=6){
System.out.println("5:00");
}
else{
System.out.println("6:00");
}
}
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int days=sc.nextInt();
boolean vacation=sc.nextBoolean();
Program.met(days, vacation);
}
}
Answered by capricornusyellow
1

Tiktok v2

Explanation:

  • { public static void met(int days, boolean vacation){ if(vacation){ if(days>=2&&days<=6){ System.out.println("7:00"); } else{ System.out.println("9:00"); } } else { if(days>=2&&days<=6){ System.out.println("5:00"); } else{ System.out.println("6:00"); } } } public static void main(String[] args) { Scanner sc=new Scanner(System.in); int days=sc.nextInt();  boolean vacation=sc.nextBoolean(); Program.met(days, vacation); }
  • Import java.util.Scanner;
  • Public class Program

Learn more: Java

https://brainly.in/question/22524625

Similar questions