top of page

Problem 1:
Create a Java class and create the following methods
- oddEvenMatchRec: the method takes an integer array as a parameter
and returns a boolean. The method returns true if every odd index
contains an odd integer AND every even index contains an even integer(0 is
even). Otherwise it returns false.
- sumNRec: The method takes an integer n and returns the sum of numbers
from 1 to n.
- nDownToOne: Takes an integer n and prints out the numbers from n down
to 1, each number on its own line.
- inputAndPrintReverse: Inputs integers from the user until the user
enters 0, then prints the integers in reverse order. For this method, you
may NOT use an array or any type of array structure, in other words, you
may not use any structure to store the user input.
- After completing the methods, use the main method to test them. You can
hard code the tests.
General Instructions:
- No hard copies will be collected.
- Do not send your files through the email!
- You should submit your work by the due date, No extensions will be given.
(See syllabus for late homework policy).
- DO NOT turn in multiple files, only one .zip file.
What to turn in:
There should be one .java files(, put all those files into a
zip file and name it <YourFirstName_YourLastName>.zip, submit the zip file into
the Dropbox on D2L.
How to zip multiple files?
On Windows: Select all the files > right click > Send to > Comprised File
On Mac: Select all the files > Click/Tap with two fingers > Compress Items

CS304, Data Structures, Homework 5

  • PDF File

    Contains Complete Java Solution Code and Problem.

bottom of page