Easy Program

 

  1. Create a Java program, Ch02_MinutesInMonthsDays.java, that displays in months, days, hours, and minutes for a big number entered in minutes. We assume one month has 30 days.  The program may use operands “/” and “%” several times.  The result will show like this:

Enter a big number in minutes like 300000: 300000

300000 minutes consist of

6 months

28 days

8 hours

0 minutes.

 

 

  1. Create a java program, Ch03_WeekDay.java that prints the day of this week for the entered numerical day. The program may use the commands switch, case, and break several times.  An output will look like as below.

Enter a day between 18 and 24: 19

It is Monday.

 

  1. Create a java program, Ch04_TwoWords, that displays two words in alphabetical order for the string with two words. The program may use the commands like indexOf, compareTo. The console display will be as below.

Enter two words divided by a blank space: Los Angeles

The words in alphabetical order are Angeles Los

 

  1. Create a java program, Ch05_AreaConversion, that converts Acres to Square Feet and vice versa as the table below. Conversion ratio is 1 acre = 43560 square feet.  Acres should increment by 1 from 1 acre to 10.  The Square Feet should increment by 10000 from 10000 sqaure feet to 100000.

Acres     SquareFeet    |       SquareFeet          Acres

———————————————————————–

1          43560    |            10000          0.230

2          87120    |            20000          0.459

3         130680    |            30000          0.689

4         174240    |            40000          0.918

5         217800    |            50000          1.148

6         261360    |            60000          1.377

7         304920    |            70000          1.607

8         348480    |            80000          1.837

9         392040    |            90000          2.066

10         435600    |           100000          2.296

 

Start with the following program and set up “for” or “while” loop to display as above.

public class Ch05_AreaConversion {

public static void main(String[] args) {

System.out.printf(“%15s%15s    |  %15s%15s\n”, “Acres”, “SquareFeet”,

“SquareFeet”, “Acres”);

System.out.println(“———————————————————————–“);

 

 

}

}

 

An example of data formatting is as follows.

    System.out.printf(“Tuition will be $%10.2f in %5d years”,  tuition, year);

 

Order from us and get better grades. We are the service you have been looking for.