Skip to content

University Java course I took that taught Object-oriented programming

Notifications You must be signed in to change notification settings

movinglightspeed/CSIS-212-OOP

Repository files navigation

CSIS-212-OOP

Work done through Object Oriented Programming class. Grade received: A

Assignment 1 Program 1

In this new age of Technology (Website, social media, etc., we have been given the opportunity to minister and serve others in many ways. Using the techniques you have learned in this chapter, write a Program which displays at least 5 different sentences that explain how technology has been used to win souls to Christ.

Program 2

Write a portion of a Program for a church’s website. The Program will be used for a chatting feature, which will include an Input Box (Dialog Boxes and the JOptionPane) that requests the user’s name. The message box will include the user’s name and the Scripture of the Day (chapter and verse only).

The Program will be similar to the text below: Welcome, Bob, To The Liberty University Website! The Scripture for the day is: Matthew 6:11

The assignment must have the following statements and components as demonstrated in the text: 1 Java file and 1 Class file, Variable, Input Statement, and Program will follow Java Programming Conventions as shown in the Grading Rubric.

Program 3

Exercise 2.14 JHTP: Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by 1 space. Use the following techniques to accomplish learning the three ways to print using Java. a. Use 1 System.out.println statement b. Use 4 System.out.print statements c. Use 1 System.out.printf statement

Program 4

Exercise 2.15 JHTP: Write an application that ask the user to enter 2 integers, obtains them from the user and prints their sum, product, difference and quotient (division). Use the techniques shown in Figure 2.7.

Program 5

Exercise 2.26 JHTP: Write an application that reads 2 integers, determines whether the first is a multiple of the second and prints the result. [Hint: Use the remainder operator.]

Assignment 2 Exercise 3.20 JHTP (Salary Calculator): Develop a Java application that determines the gross pay for each of three (3) employees. The company pays straight time for the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40. You’re given a list of employees, their number of hours worked last week, and their hourly rates [create your own information/data here to input into the program]. Your program should input this information/data for each employee, then determine and display the employee’s gross pay. Use class Scanner to input the employee data.

Assignment 3 Exercise 4.12: Write an application that calculates the product of the odd integers from 1 to 15.

Exercise 4.16 JHTP (Bar Chart Printing Program): One interesting application of computers is to display graphs and bar charts. Write an application that reads 5 numbers between 1 and 30. For each number that reads, your program will display the same number of adjacent asterisks. For example, if your program reads the number 7, it will display *******. Display the bars of asterisk after you read all 5 numbers.

Assignment 4 Exercise 5.16 JHTP: Write a method isMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The method will take 2 integer arguments and return true if the second is a multiple of the first and false otherwise. [Hint: Use the remainder operator]. Incorporate this method into an application that inputs a series of pairs of integers (1 pair at a time) and determines whether the second value in each pair is a multiple of the first.

Exercise 5.20 (Circle Area): Write an application that prompts the user for the radius of a circle and uses a method called circleArea to calculate the area of the circle.

Exercise 5.35 (Computer-Assisted Instruction): The use of computers in education is referred to as computer ¬assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use a Random object to produce 2 positive 1-digit integers. The program will then prompt the user with a question, such as “How much is 6 times 7?”

The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message “Very Good!” and ask another multiple question. If the answer is wrong, display the message “No. Please try again.” And let the student try the same question repeatedly until the student finally gets it right. A separate method will be used to generate each new question. This method will be called once when the application begins execution and each time the user answers the question correctly.

Assignment 5 Exercise 6.14 JHTP: (Variable-Length Argument List) Write an application that calculates the product of a series of integers that are passed to method product using a variable-length argument list. Test your method with several calls, each with a different number of arguments.

Exercise 6.17 JHTP: (Dice Rolling) Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the clause will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent. Figure 6.21 shows the 36 possible combinations of the two die. Your application should roll the dice 36,000 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in a tabular format.

Assignment 6 Exercise 7.13 JHTP (Date Class): Create a class called Date that includes 3 instance variables—a month (type int), a day (type int), and a year (type int). Provide a constructor that initializes the 3 instance variables and assumes the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day, and year separated by forward slashes(/). Write a test application named DateTest that demonstrates class Date’s capabilities.

Assignment 7 Exercise 8.4 JHTP (Rectangle Class): Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle’s perimeter and area. Use set and get methods for both length and width. The set methods will verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle. Notes:

  1. In the test class write code to create and print a menu that returns a value corresponding to the menu choice.
  2. Also in the test file, remember to code a Try Catch Illegial Argument Expection to determine if the user entered a length and width of 0.0-20.

Assignment 8 Exercise 9.5 JHTP: Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig 9.2. Use Student as the superclass of the hierarchy, then, extend Student with classes Undergraduate Student and Graduate Student. Continue to extend the hierarchy as deep (i.e., as many levels as possible). For example, Freshmen, Sophomore, Junior, and the Senior might extend Undergraduate Student and Doctoral Student and Masters Student might be subclasses of Graduate Students. After drawing the hierarchy, discuss the relationships that exist between the classes. Exercise 10.6: How does polymorphism promote extensibility? Exercise 10.12: Payroll Modification Modify the payroll system of Figs 10.4 –10.9 to include private instance variable birthdate in class Employee. Use class Date of Fig 8.7 to represent an employee’s birthday. Add get methods to class Date. Assume that payroll is processed once per month. Create an array of Employee variables to store references to the various employee objects. In a loop, calculate the payroll for each Employee (polymorphic ally), and add a $100.00 bonus to the persons payroll amount if the current month is the one in which the Employee’s birthdate occurs.

Final Project Assignment 1 (40 points)

Write an application containing three parallel arrays that hold 10 elements each. The first array hold four-digit student ID numbers, the second array holds first names, and the third array holds the students’ grade point averages. Use dialog boxes to accept a student ID number and display the student’s first name and grade point average. If a match is not found, display an error message that includes the invalid ID number and allow the user to search for a new ID number.

Final Project Part 2 (40 points)

Create an application that contains an enumeration (enum) that represents the days of the week. Display a list of the days, then prompt the user for a day. Display business hours for the chosen day. Create your own business hours stored in an array; however, every day of the week should have different hours. Although companies do not normally have different business hours every day of the week, programming your code with this difference will help in finding and fixing coding errors.

About

University Java course I took that taught Object-oriented programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages