Programming Assignment 1 Instructions
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.
Instructions: Write a portion of a program for a church’s website. The program will be used for a chatting feature, which should include an Input Box that requests the user’s name. The message box should include the user’s name and the Scripture of the Day (chapter and verse only).
The program should 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
Program should follow Java Programming Conventions as shown in the Grading Rubric.
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:
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
Exercise 2.16 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.]
Programming Assignment 2
Exercise 3.11 (Modified GradeBook Class) Modify class Gradebook (fig. 3.10) as follows:
Exercise 3.14 JHTP (Employee Class) Create a class called Employee that includes 3 instance variables—a first name (type String), a last name (type String), and a monthly salary (double). Provide a constructor that initializes the 3 instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value. Write a test application named EmployeeTest that demonstrates class Employee’s capabilities. Create 2 Employee objects and display each object’s yearly salary. Then give each Employee a 10% raise and display each Employee’s yearly salary again.
Exercise 3.15 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.
Exercise: 4.19 (JHTP) (Sales Commission Calculator) A large company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5,000 worth of merchandise in a week receives $200 plus 9% of $5,000, or a total of $650. You been supplied with a list of the items sold by each person. The values of these items are as follows:
Develop a Java application that inputs one salesperson’s items sold for last week and calculates and displays that salesperson’s earnings. There is no limit to the number of items that can be sold by a salesperson
Exercise 5.12 Write an application that calculates the product of the odd integers from 1 to 15.
Exercise: 5.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 should display the same number of adjacent asterisks. For example, if your program reads the number 7, it should display *******. Display the bars of asterisk after you read all 5 numbers.
Enter some numbers between 1 and 30 and separated by the symbol "-" to display the bar
Exercise 5.32 (JHTP) According to CNNMoney.com, Facebook hit 500 million users in July of 2010 and its user base has been growing at a rate of 5%per month. Using the compound-growth technique you learned in Fig 5.6 and assuming this growth rate continues, how many months will it take to grow is user base to 1 billion users? How many months will it take for Facebook to grow its user base to 2 billion users (which, at the time of this writing, was the total number of people on the Internet)?
Programming Assignment 4
Exercise 6.16 JHTP Write anisMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The method should 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 6.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 6.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 should 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’s 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 should be used to generate each new question. This method should be called once when the application begins execution and each time the user answers the question correctly.
Programming Assignment 5
Exercise 7.14 JHTP 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 7.19 JHTP A small airline has just purchased a computer for its new automated reservations system. You’ve been asked to develop the new system. You’re to write an application to assign seats on each flight of the airline’s only plane (capacity: 10 seats).
Your application should display the following alternatives: “Please type 1 for First Class” and “Please type 2 for Economy.” If the user types 1, your application should assign a seat in the first class section (seats 1–5). If the user types 2, your application should assign a seat in the economy section (seats 6–10). You application should then display a boarding pass indicating the person’s seat number and whether it’s in the firstclass or economy section of the plane.
Use a 1 dimensional array of primitive type Boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available.
Your application should never assign a seat that has already been assigned. When the economy section is full, your application should ask the person if it’s acceptable to be placed in the first class section (and vice versa). If yes, make the appropriate seat assignments. If no, display the message “Next flight leaves in 3 hours.”
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. It has set and get methods for both length and width. The set methods should 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.
Programming Assignment 6
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. [Note: You do not need to write any code for this exercise].
Exercise 10.5 How does polymorphism promote extensibility?
Exercise 10.8 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.
Programming Assignment 7
Ex 11.9 Write a program that shows that the order of catch blocks is important. If you try to catch a superclass exception type before a subclass type, the compiler should generate errors.
Ex 11.17 Use inheritance to create an exception superclass (called ExceptionA) and exception subclasses ExceptionB and ExceptionC, where ExceptionB inherits from ExceptionA and ExceptionC inherits from ExceptionB. Write a program to demonstrate that the catch block for type A ExceptionA catches exceptions of types ExceptionB and Exception C.
Ex 11.18 Write a program that demonstrates how various exceptions are caught with
Catch (Exception exception).
This time define classes ExceptionA (which inherits from class Exception) and ExceptionB (which inherits from class ExceptionA). In your program, create try blocks that throw exceptions of types ExeptionA, ExceptionB, NullPointerException and IO Exception. All exceptions should be caught with catch blocks specifying type Exception.
Programming Assignment 8
Exercise 14.11 Create the following GUI. You do not have to provide any functionality.
Exercise 23.3 Write an applet that asks the user to enter 2 floating-point numbers, obtains the 2 numbers from the user and displays the 2 numbers, then displays the larger number followed by the words “is larger” as a string on the applet. If the numbers are equal, the applet should print the message “These numbers are equal.” Use the techniques shown in Fig. 23.9.
Exercise 23.5 Write an applet that asks the user to input the radius of a circle as a floating-point number and draws the circles diameter, circumference and area. Use the value 3.14159 for∏. Use the techniques shown in Fig 23.9. Use the following formulas (r is the radius):
· Diameter = 2r
· Circumference = 2∏r
· Area = ∏ r2
Here is solution for BMIS 212 Entire Course
Solution contain java program and classes, Using Netbean, Eclipse or any Java IDE to open and run program.
If you have any questions, please send to us via email email@example.com ,we will help you any time