Question

Submit this part as separate text file named Lab4Questions. Activities: Magic Dates [8 pts] The date June 10, 1960, is specia

java programming

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey Chegger,

The code for the above problem:

NOTE: The screenshot of the code editor along with the code and output is attached for the reference.

import java.util.*;

public class Main
{
   public static void main(String[] args) {
   Scanner sc= new Scanner(System.in); //Defining the scanner class for taking the user input.
   //NOTE: Month = m, Date = d, and Year = y.
   //Input of month.
System.out.print("Enter the month number: ");
int m= sc.nextInt();
  
//Input of date.
System.out.print("Enter the particular date: ");
int d= sc.nextInt();
  
//Input of year.
System.out.print("Enter the last two digits of the year: ");
int y= sc.nextInt();
  
int check = m*d;
  
//Checking the given condition.
if(check == y)
{
System.out.println("Congratulations!!! The data is a Magic date.");
}
else
{
System.out.println("Oops!!! The data is a Not a Magic date.");
}
  
   }
}

Screenshot of Code Editor:

Main.java 1 import java.util.*; 3 public class Main 4- { public static void main(String[] args) { Scanner sc= new Scanner(Sys
Screenshot of Output:

input Enter the month number: 6 Enter the particular date: 10 Enter the last two digits of the year: 60 Congratulations!!! Th

Add a comment
Know the answer?
Add Answer to:
java programming Submit this part as separate text file named Lab4Questions. Activities: Magic Dates [8 pts]...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Language: Java The date June 10 1960 is special because when it is written in the...

    Language: Java The date June 10 1960 is special because when it is written in the form: month times day it will equal to the year (last two digits only). For example, 6 (for June) times 10 (day 10) equals 60 (the last two digits of year 1960). Write program to prompt user to enter month as an integer, day as an integer and a 2-digits integer for the year. No need to validate these input. Only test for being...

  • Can someone please help me with this problem, I am new in this and I got no idea how to make it ?

    Must contain several methods to provide reading functions,performing calculations and posting the results.Main Main method for executing execution Method for reading data from the keyboard Method for performing calculations according to the problem request Method for posting resultsThe main method must contain at least:A menu for selecting the function (Reading data, Performing calculations, Posting ioutput, Exit the program) using the switch / case instruction.The menu must be included within a do / while cycle in order for the e functions...

  • Java Programming Design a class named Person and its two subclasses named Student and Employee. A...

    Java Programming Design a class named Person and its two subclasses named Student and Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, date hired. Define a class named MyDate that contains the fields year, month, and day. Override the toString method in each class to display the class name and the person's name....

  • Java Programming Reading from a Text File Write a Java program that will use an object...

    Java Programming Reading from a Text File Write a Java program that will use an object of the Scanner class to read employee payroll data from a text file The Text file payroll.dat has the following: 100 Washington Marx Jung Darwin George 40 200 300 400 Kar Car Charles 50 22.532 15 30 The order of the data and its types stored in the file are as follows: Data EmployeelD Last name FirstName HoursWorked double HourlyRate Data Tvpe String String...

  • C Programming Quesition (Structs in C): Write a C program that prompts the user for a...

    C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...

  • JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year...

    JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year of storm/ Name of storm/ mmdd storm started/ mmdd storm ended/ magnitude of storm/ //made up data 2004/Ali/1212/1219/1 2003/Bob/1123/1222/3 1980/Sarah/0123/0312/0 1956/Michael/1211/1223/4 1988/Ryan/0926/1019/ 1976/Tim/0318/1010/0 2006/Ronald/0919/1012/2 1996/Mona/0707/0723/1 2000/Kim/0101/0201/1 2001/Jim/1101/1201/3 Text file Class storm{ private String nameStorm; private int yearStorm; private int startStorm; private int endStorm; private int magStorm; public storm(String name, int year, int start, int end, int mag){ nameStorm = name; yearStorm = year; startStorm...

  • Multiples of 9’s (JAVA) Using the logic behind the algorithm in Part 1, it’s easy to...

    Multiples of 9’s (JAVA) Using the logic behind the algorithm in Part 1, it’s easy to calculate the first nine multiples of 9 (9x1, 9x2, 9x3…, 9x9). Let’s use two examples. First, to determine the product of 9 times 6, perform the following algorithm: Step 1: Subtract 1 from the number being multiplied by 9 (in this case 6) to get the first digit of the product: 6 – 1 =  5. Step 2: Subtract that digit from 9 to get...

  • Write a java netbeans program. Project Two, Super Bowl A text file named “SuperBowlWinners.txt” contains the...

    Write a java netbeans program. Project Two, Super Bowl A text file named “SuperBowlWinners.txt” contains the names of the teams that won the Super Bowl from 1967 through 2019. Write a program that repeatedly allows a user to enter a team name and then displays the number of times and the years in which that team won the Super Bowl. If the team entered by the user has never won the Super Bowl, report that to the user instead. For...

  • Part I: (The Myate class) Design a class named MyDate. The class contains: • The data...

    Part I: (The Myate class) Design a class named MyDate. The class contains: • The data fields year, month, and day that represent a date. Month is 0-based, i.e., 0 is for January. • A no-arg constructor that creates a MyDate object for the current date. • A constructor that constructs a MyDate object with a specified elapsed time since midnight, January 1, 1970, in milliseconds. • A constructor hat constructs a MyDate object with the specified year, month, and...

  • In C++ Programming Write a program in a file named SeedFinder.cpp that finds and displays all...

    In C++ Programming Write a program in a file named SeedFinder.cpp that finds and displays all the seeds of a integer given by the user. Let’s define a seed of an integer, n, to be a positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 23 × 2 × 3 = 138. 111 is an example of a seed of itself because 111 × 1 × 1 × 1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT