Question
* Einstein’s famous formula E = MC2 gives the amount of energy released by the complete conversion of matter of mass M into energy E. If M represents the mass in kilograms and C represents the speed of light in meters per second (3.0 * 108 m/s), then the result is in the energy unit Joules. It takes 36000 Joules to light a 100 watt light bulb for an hour. Write a Java program that calculates the energy and the number of light bulbs that could be powered by a given mass of matter. Input a double value from the keyboard, and use scientific notation (E notation) and printf statements. Output should look similar to below.

Sample Run:
Enter the mass in kg: 0.01
This mass could provide 9E+14 Joules of energy.
It could power 2.5E+09 100 watt light bulbs for an hour.

* Angles are often measured in degrees (°), minutes ('), and seconds ("). There are 360 degrees in a circle, 60 minutes in one degree, and 60 seconds in one minute. Write a Java program that reads two angular measurements given in degrees, minutes, and seconds, and then calculates and displays their sum. Format the output with appropriate symbols (°,',").

Output should look similar to below.
Note: Use Unicode values for the symbols.

Sample Runs:
Enter the degrees: 74
Enter the minutes: 29
Enter the seconds: 13
2
Enter the degrees: 105
Enter the minutes: 8
Enter the seconds: 16
The sum of the angles: 179°37'29"
Enter the degrees: 20
Enter the minutes: 31
Enter the seconds: 19
Enter the degrees: 0
Enter the minutes: 31
Enter the seconds: 30
The sum of the angles: 21°2'49"
Enter the degrees: 122
Enter the minutes: 17
Enter the seconds: 48
Enter the degrees: 237
Enter the minutes: 42
Enter the seconds: 12
The sum of the angles: 0°0'0"

* Have you heard of the Fizz Buzz problem? Some businesses claim they interview Computer Science graduates they can't solve the Fizz Buzz problem. Write a Java program that prints asks the user to enter a positive value (1 less than or equal to 200) and print each number up to that line, 1 per line with the following changes (SNAP CRACKLE POP).
• If a number is divisible by 2 (but not 3 or 5) print out SNAP instead of the integer.
• If a number is divisible by 3 (but not 2 or 5) print out CRACKLE instead of the integer.
• If a number is divisible by 5 (but not 2 or 3) print out POP instead of the integer.
• If a number is divisible by 2 and 3 (but not 5) print out SNAPCRACKLE instead of the integer.
• If a number is divisible by 2 and 5 (but not 3) print out SNAPPOP instead of the integer.
• If a number is divisible by 3 and 5 (but not 2) print out CRACKLEPOP instead of the integer.
• If a number is divisible by 2, 3, and 5 print out SNAPCRACKLEPOP instead of the integer.

Error check inputs. Output should look similar to below.
3

Sample Runs:
Enter a positive value: 7
1
SNAP
CRACKLE
SNAP
POP
SNAPCRACKLE
7

Enter a positive value: 10
1
SNAP
CRACKLE
SNAP
POP
SNAPCRACKLE
7
SNAP
CRACKLE
SNAPPOP
Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references.
Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.

public class DisplayLeapYears {
   
    public static void main(String[] args) {
       boolean isLeapYear;
       int i = 0;
       for (int year = 101; year <= 2100; year++) {
            isLeapYear = (
                        year % 4 == 0 &&
                        year % 100 != 0
                   ) ||
                   ( year % 400 == 0 );
            if (isLeapYear) {
                System.out.printf("%6d", year);
                i++;
            }      
            if (i == 10) {
                System.out.printf("%n");
                i = 0;
This is only a preview of the solution.
Please use the purchase button to see the entire solution.
By purchasing this solution you'll be able to access the following files:
Solution.zip
Purchase Solution
$26.25
Google Pay
Amazon
Paypal
Mastercard
Visacard
Discover
Amex
View Available Computer Science Tutors 645 tutors matched
Ionut
(ionut)
Master of Computer Science
Hi! MSc Applied Informatics & Computer Science Engineer. Practical experience in many CS & IT branches.Research work & homework
5/5 (6,808+ sessions)
1 hour avg response
$15-$50 hourly rate
Pranay
(math1983)
Doctor of Philosophy (PhD)
Ph.D. in mathematics and working as an Assistant Professor in University. I can provide help in mathematics, statistics and allied areas.
4.6/5 (6,701+ sessions)
1 hour avg response
$40-$50 hourly rate
Leo
(Leo)
Doctor of Philosophy (PhD)
Hi! I have been a professor in New York and taught in a math department and in an applied math department.
4.9/5 (6,469+ sessions)
2 hours avg response

Similar Homework Solutions