Cash-back offer from April 14th to 21st, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 70.00

CSIS 312 LU Programming Assignments 1, 2, 3, 4, 5, 6, 7, 8

Question posted by
Online Tutor Profile
request

Assignment 1-1

Using the Time2 class of Fig 8.5 of your Deitel & Deitel text, it would be perfectly possible to represent the time internally as the number of seconds since midnight rather than with the three integer values hour, minute, and second. Clients could use the same public methods and get the same results. Modify the Time2 class so that time is represented internally as seconds and then use Time2Test.java to test your modified Time2 class. 

 

Assignment 1-2

Using your modified Time2 class from Assignment 1-1, add a tick method that increments time stored in the Time2 object by one second. Also provide an incrementMinute method to increment the minute by one and an incrementHour method to increment the hour by one. Be sure that you test for cases where incrementing the second, minute, or hour moves your time into the next day (i.e., 11:59:59 PM to 12:00:00 AM).

 

Assignment 2

In chapter 9 of your Deitel & Deitel text, you studied an inheritance hierarchy in which class BasePlusCommissionEmployee inherited from class CommissionEmployee. However, not all types of employees are CommissionEmployees.

 

In this exercise, you’ll create a more general Employee superclass that factors out the attributes and behaviors in class CommissionEmployee that are common to all Employees. The common attributes and behaviors for all Employees are firstName, lastName, socialSecurityNumber, getFirstName, getLastName, getSocialSecurityNumber and a portion of method toString.

 

Create a new superclass Employee that contains these instance variables and methods and a constructor.

 

Next, rewrite class CommissionEmployee from Section 9.4.5 as a subclass of Employee. Class CommissionEmployee should contain only the instance variables and methods that are not declared in superclass Employee. Class CommissionEmployee’s constructor should invoke class Employee’s constructor and CommissionEmployee’s toString method should invoke Employee’s toString method.

 

Once you’ve completed these modifications, run the BasePlusCommissionEmployeeTest app using these new classes to ensure that the app still displays the same results for a BasePlusCommissionEmployee object.

 

Make sure that your screen shots show your program running and that your runtime display shows that your program does all that is required of it.  You only get credit for what you demonstrate.

Assignment 3

Modify the payroll system of Figs. 10.4–10.9 to include an additional Employee subclass PieceWorker that represents an employee whose pay is based on the number of pieces of merchandise produced.

 

Class PieceWorker should contain private instance variables wage (to store the employee’s wage per piece) and pieces (to store the number of pieces produced).

 

Provide a concrete implementation of method earnings in class PieceWorker that calculates the employee’s earnings by multiplying the number of pieces produced by the wage per piece.

 

Create an array of Employee variables to store references to objects of each concrete class in the new Employee hierarchy (SalariedEmployee, CommissionEmployee, HourlyEmployee, BasePlusCommissionEmployee, and now PieceWorker).

 

For each Employee, display its String representation and earnings.

Assignment 4

Write an application that uses random-number generation to create sentences. Use four arrays of strings, called article, noun, verb, and preposition.

 

Create a sentence by selecting a word at random from each array in the following order:

1.      article,

2.      noun,

3.      verb,

4.      preposition,

5.      article, and

6.      noun.

 

As each word is picked, concatenate it to the previous words in the sentence. The words must be separated by spaces. When the final sentence is output, it should start with a capital letter and end with a period. The application must generate and display 20 sentences.

 

·         The article array must contain the articles “the,” “a,” “one,” “some,” and “any.”

·         The noun array must contain the nouns “boy,” “girl,” “dog,” “town,” and “car.”

·         The verb array must contain the verbs “drove,” “jumped,” “ran,” “walked,” and “skipped.”

·         The preposition array must contain the prepositions “to,” “from,” “over,” “under” and “on.”

Assignment 5-1 (35 Points)

Write a program that inserts 25 random integers from 0 to 100 in order into a LinkedList object.

 

The program must:

·         sort the elements,

·         then calculate the sum of the elements, and

·         calculate the floating-point average of the elements.

 

Assignment 5-2 (35 Points)

Write a program that creates a LinkedList object of 10 characters, then creates a second LinkedList object containing a copy of the first list, but in reverse order. Print out both LinkedList’s starting with the first list in list order.

 

For both assignments make sure that your screen shots show your program running and that your runtime display shows that your program does all that is required of it.  You only get credit for what you demonstrate.

 

Assignment 6-1 (35 Points)

It is interesting to watch recursion “in action.” Modify the factorial method in Fig. 18.3 to print its local variable and recursive-call parameter.

 

For each recursive call, display the outputs on a separate line and add a level of indentation. Do your utmost to make the outputs clear, interesting, and meaningful. Your goal here is to design and implement an output format that makes it easier to understand recursion.

 

Assignment 6-2 (35 Points)

Write a recursive method printArray() that displays all the elements in an array of integers, separated by spaces. The array must be 100 elements in size and filled using a for loop and a random number generator. The pseudo-code for this is as follows:

 

//Instantiate an integer array of size 100

//fill the array

For (int i=0; i

Array[i] = random number between 1 and 100 inclusive

printArray(integer array);

 

For both assignments make sure that your screen shots show your program running and that your runtime display shows that your program does all that is required of it.  You only get credit for what you demonstrate.

 

Assignment 7

Write a generic class Pair which has two type parameters—F and S—each representing the type of the first and second element of the pair, respectively. Add set and get methods for the first and second elements of the pair. (Hint: The class header should be public class Pair.)

 

Write a separate PairTest class to test class Pair. Create 2 Pair types and test your get and set methods on the following pair types:

·         Pair p1 takes Integer and String types as a pair

·         Pair p2 takes String and Integer

 

PairTest should output enough information to the terminal to show that your generic class Pair is able to set() and get() different types.

 

Assignment 8

Write a program that uses a stack to reverse its inputs.  Your stack must be generic and you must demonstrate that it accepts both String and Integer types.  Your stack must implement the following methods:

·         push,

·         pop,

·         isEmpty (returns true if the stack is empty and false otherwise), and

·         size (returns an integer value for the number of items in the stack). 

You may use either an ArrayList or a LinkedList to implement your stack.  Also, your pop method must throw an IndexOutOfBoundsException if the user attempts to “pop” something off an empty stack.  Name your stack class “Stack” and put it in a file named Stack.java.

Create a StackTest.java file to demonstrate all of the methods of your stack.  Instantiate two stacks; one for String and one for Integer.  Push words/integers onto your stack.  After you have pushed a series of words/integers on your stack use a while loop to pop and print each item.  If your stack is working properly your inputs should print in reverse order.  Be sure that you calls to pop are in a try statement and will catch the IndexOutOfBoundsException, if thrown.

Note: Java has a Stack class, but you may not use it.  You must create your own Stack class and your class must have the following operations (all of which must be demonstrated): push, pop, isEmpty, and size.

Here is an example screen shot of a working stack that reverses words and integers:

​​​​​​​

 

 

 

Available Answer
$ 70.00

[Solved] CSIS 312 LU Programming Assignments 1, 2, 3, 4, 5, 6, 7, 8

  • This Solution has been Purchased 13 time
  • Average Rating for this solution is A+
  • Submitted On 10 Dec, 2017 01:35:01
Answer posted by
Online Tutor Profile
solution
All Solutions for entire class Included...
Buy now to view the complete solution
attachment
Attachment
Other Similar Questions
User Profile
4.0St...

CSIS 312 LU Programming Assignments 1, 2, 3, 4, 5, 6, 7, 8

All Solutions for entire class Included in one order. Programming Assignments 1-8 CSIS312 (BMIS 312) LU ...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35