Title: JH5 Homework
Course: CPS 161: An Intro to Programming with Java - DL MM MASTER

JH5 Homework (100 points)

Create an Eclipse project named JH5_xxxxx where xxxxx is your NetID. For example: JH5_chasselb. Create the programs described below in this project. Fill in the required fields in the JH5_worksheet.txt file. Export your project file and upload it to blackboard as your work for this assignment. The worksheet file will be pasted into the blackboard comments section.

As you write your code make sure you adhere to the following standards:          Rubric

Get started early, and don't skip necessary video/lectures. If you find yourself stuck doing JH5, you should consider doing the practice work that would help prepare you for JH5:

Practice for JH5

Make sure you do your Class Participation (10 points)

fractions problem (25 points):

Create a package named fractions and execute the following instructions:

Click here for the instructions:

Run the program with the specified calculations near the end of the instructions and insert the results in the appropriate section of the JH5 worksheet.

string_array problem (10 points):

Create a package named string_array and write a program that creates an array of Strings with the name of "firstNames".

Fill the array with the names(in this order): "George", "Fred", "Sam", "Mary", "Sarah", "Bella", "Joy", "Rita", "Marta", "Sue", "Nancy"

Print the values of the firstNames array backwards. In otherwords, your output should be:

Nancy Sue Marta Rita Joy Bella Sarah Mary Sam Fred George

Run the program and insert the results in the appropriate section of the JH5 worksheet.

date_array problem (10 points):

Create a package named date_array and you will need 2 classes. Create a class called MyDate. This class only needs the following things:

- Instance variables for month, day and year
- Constructor: MyDate(String month, int day, int year) - the code stores the values in 3 instance variables
- String toString() method - returns a String containing your 3 instance variables.

Create another class called DateArray that creates an array of "MyDate" with the name of "dateArr".

The array should have 4 entries and the entries should be filled with MyDate classes representing the dates:

May 16, 1984
November 14, 1978
September 21, 1980
July 3, 1987

The DateArray class should print the values of the dateArr array backwards. Your MyDate classes can be printed using a toString() method in the MyDate class.

Run the program and insert the results in the appropriate section of the JH5 worksheet.

one_dimensional_array problem (15 points):

Create a package named one_dimensional_array and write a class that completes the following "OneDimensionalArrays" class. You will complete the class by filling in code wherever you see the comment:
//******* FILL IN CODE *********

import java.util.Scanner;

public class OneDimensionalArrays {

    int[] createIntegers(int size_of_array)
    {
       //*******  FILL IN CODE *********
       // Your code will create an array of ints as large as specified in size_of_array
       // Fill the array in with the values: 0, 100, 200, 300, ....
       // Return the array that you just created
    }
    void printArray(int[] myArray)
    {
        //*******  FILL IN CODE *********
        // Print out your array with one number per line.  Get the size of the
        // array from the "myArray" parameter (no hard coding the size)
    }

    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);

        System.out.println("Enter size of array to create: ");
        int num = keyboard.nextInt();

        //*******  FILL IN CODE *********
        // Construct an instance of the OneDimensionalArrays class
        // Using this object instance, call createIntegers to create
        // an array of integers.  Don't forget to save the results
        // Then call the printArray method to print out the contents
        // of your array.


    }

}



Run your program and insert the results in the appropriate section of the JH5 worksheet.

fantasy_football problem (30 points):

Create a package named fantasy_football and execute the following instructions:

Click here for instructions

Run your program with at least 3 teams and 2 weeks. Make sure the number of teams and the number of weeks are different. Insert the results in the appropriate section of the JH5 worksheet.

September 3, 2015 5:48 AM