Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am in need of some help with my Java APCS class. I have to finish the program with the correct code, however for these

I am in need of some help with my Java APCS class. I have to finish the program with the correct code, however for these few I do not understand fully what I needed to add. Anythig would be appeciated. Thank you!

4.

Complete the following method that tells the number of days in a given year. A standard year has 365 days, and a leap year has 366 days. Here is how to determine if year is a leap year:

If year is evenly divisible by 4 and it's not evenly divisible by 100, it's a leap year.

If year is evenly divisible by 400, it's also a leap year.

For example, the following years were leap years: 2000, 1996, 1992.

The following years were not leap years: 1900, 1800. (10 points)

public static int daysInYear(int year) {

}

6.

Complete the following method that takes a String parameter that is a time in standard international 24 hour format, such as "18:12."

The method returns a String with the same time in American 12 hour form that ends with AM or PM. For example, given the parameter in the example above, the method would return "6:12 PM."Use AM for midday times from 00:00 to 11:59 and PM for times from 12:00 to 23:59.

Recall the method Integer.parseInt() takes a String parameter and returns the integer equivalent. (15 points)

// precondition: the String value of the time parameter is valid and between // 00:00 and 23:59 and has a length of 5 characters. public static String convertTime(String worldFormat) {

}

15.

The calcCircleCircumf() method invoked within in the CircleStatsTester class is overloaded. Write the overloaded methods in the incomplete public CircleStatsclass. (10 points)

public class CircleStats { public CircleStats() { }

//...code goes here }

public class CircleStatsTester { public static void main(String[] args) {

int diameter = 5; double radius = 2.5; CircleStats cStats = new CircleStats();

System.out.println("The circumference = " + cStats.calcCircleCircumf(diameter)); System.out.println("The circumference = " + cStats.calcCircleCircumf(radius));

} }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions