Concept explainers
Magic Dates
The date June 10, 1960, is special because when we write it in the following format, the month times the day equals the year.
6/10/60
Design a class named MaginData. The class constructor should accept, as integers, values for a month, a day, and a year. The class should also have a method named isMagic that returns true if the date passed to the constructor is magic, or false otherwise.
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with Java: Early Objects (6th Edition)
Additional Engineering Textbook Solutions
Programming in C
Problem Solving with C++ (9th Edition)
Starting out with Visual C# (4th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Database Concepts (7th Edition)
Starting Out with Python (4th Edition)
- 33 C++ DO NOT COPY FROM OTHER WEBSITES Correct and detailed answer will be Upvoted else downvoted. Thank you!!!arrow_forwardThe code for a class, the code for a method, and the code for while and for loops with more than ones statement is enclosed in ____. /* and */ [ and ] { and }arrow_forwardRoll no. 021 Java language Give solutionarrow_forward
- #this is a python program #topic: OOP Design the Country class so that the code gives the expected output. [You are not allowed to change the code below] # Write your Class Code here country = Country() print('Name:',country.name) print('Continent:',country.continent) print('Capital:',country.capital) print('Fifa Ranking:',country.fifa_ranking) print('===================') country.name = “Belgium” country.continent = “Europe” country.capital = “Brussels” country.fifa_ranking = 1 print('Name:',country.name) print('Continent:',country.continent) print('Capital:',country.capital) print('Fifa Ranking:',country.fifa_ranking) Output: Name: Bangladesh Continent: Asia Capital: Dhaka Fifa Ranking: 187 =================== Name: Belgium Continent: Europe Capital: Brussels Fifa Ranking: 1arrow_forwardDon't use AI.arrow_forwardUsing the dialog boxes in the JOptionPane class, write a program that calculates and prints themonthly paycheck for an employee. Use the class name “LastnameClasscodeFinal1”. The netpay is calculated after taking the following deductions:a) Federal Income Tax: 15%b) State Tax: 3.5%c) Social Security Tax: 5.75%d) Medicare/Medicaid Tax: 2.75%e) Pension Plan” 5%f) Health Insurance: $ 75.00Your program should prompt the user to input the gross amount and the employee name. Formatthe output to have two decimal places. A sample output follows:arrow_forward
- 1. Pleased Write a program that calculates the average of courses, overall grade, and letter grade. Suppose that your students take four courses - English, Mathematics, Science, and History. You should design a class that accepts all four course's numeric scores, calculates average and overall grade, and decides letter grade based on the overall grade. Your class should have a constructor, get and set methods of each course, a method that calculates the average of four courses, a method that calculates overall grade, and a method that decides letter grade. The overall grades are calculated as the following rate: Average of All four courses: 50% Quiz: 40% Attendance: 10% The letter grade is based on the following: 90.0 to 100.0 - A 80.0 to 89.9 - B 70.0 to 79.9 - C 65.0 to 69.9 - D less than 65 - F Your program demonstrates the class by asking the user to input four-course numeric scores, creating an object, and then reporting each course's score, average, overall grade, and letter…arrow_forwardPrompt the user for the year they were born// b. Declare a constant for the current year.// c. Calculate and print the age the user will be this year.// d. Declare a constant for average life expectancy,// set its value to 78.94// e. Calculate and print the percentage of the user's// expected life they've lived. Use the DecimalFormat// class to format the percentage to one decimal place.// Your code goes here Its quiet diffucult what to start with?arrow_forwardPLEASE CODE IN PYTHON PLEASE USE THE CLASS FUNCTION In python, create a LunchOrder application that prompts the user for the number of hamburgers, salads, french fries, and sodas and then displays the total for the order. The LunchOrder application should includea Food object with a constructor that accepts the price, fat, carbs, and fiber for an item. Food methods should return the price of the item and return the fat, carbohydrates, and fiber. Use the chart below forfood prices and nutrition information:arrow_forward
- Assignment: Dice Rolling Program Objective: Create a Java program that rolls two dice and displays the results. The program should have two Java classes: one for a single die and another for a pair of dice. Assignment Details: User Input: Ask the user to specify the number of sides they want on each die. Ensure that the user's input is within a reasonable range. Dice Rolling: Simulate rolling the dice using Math.random() based on the user's chosen number of sides. Display the sum of the values rolled, e.g., "5 + 3 = 8." Special Combinations: If the dice roll results in combinations of 2, 7, or 12, print special messages: "1 + 1 = 2 snake eyes!" "3 + 4 = 7 craps!" "6 + 6 = 12 box cars!" Main Method: In the main method, create a pair of dice, roll them, and display the results. Allow the user to decide whether to continue rolling the dice or exit the program. Additional Features: You are welcome to add more features or enhancements to the program if desired. In…arrow_forwardUsing the dialog boxes in the JOptionPane class, write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated aftertaking thefollowing deductions: a) Federal Income Tax: 15% b) State Tax: 3.5% c) Social Security Tax: 5.75% d) Medicare/Medicaid Tax: 2.75% e) Pension Plan" 5% f) Health Insurance: $ 75.00 Your program should prompt the user to input the gross amount and the employee name. Format the output to have two decimal places. A sample output follows: Juan Dela Cruz $ 3575.00 $ 536. 25 $ 125.13 $ 205.56 $ 98.31 $ 178.75 $ 75.00 $ 2356.00 Gross Amount: Federal Tax: State Tax: Social Security Tax: Medicare/Medicaid Tax: Pension Plan: Health Insurance: Net Pay:arrow_forwardThe program must include two classesclGradesGraph and GradesGrapghDemo. GradesGraphDemo (one method)- Main method only GradesGraph- Include at least 4 methods (No credits without at least 4 methods!!!) Create a class that represents the grade distribution for a given course. In this class you should write methods to perform the following tasks: Read the number of each of the letter grades A, B, C D and F Set the number of letter grades A, B, C, D and F Return the total number of grades Return the percentage of each letter grade as a whole number between 0 and 100 inclusive Draw a bar graph of the grade distributionThe graph should have five bars, one per grade. Each bar can be a horizontal row of asterisks, such that the number of asterisks in a row is proportionate to the percentage of grades in each category. For example, let on asterisk represent 2%, so 50 asterisks correspond to 100%. Mark the horizontal axis at 10% increments from 0 to 100% and label each line with a letter…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,