Question: PART 2 Problem #1: (20 pts] a) An Internet Service Provider has three different subscription offers for its customers: Offer A: For $9.95 per month
![PART 2 Problem #1: (20 pts] a) An Internet Service Provider](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3226b18922_09066f3226a65221.jpg)



PART 2 Problem #1: (20 pts] a) An Internet Service Provider has three different subscription offers for its customers: Offer A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour Offer B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour Write a method with the header below that accepts the offer type and the number of hours and returns the total charges: public static double charge(char offer, int hours) b) Write a program that reads the offer the customer has purchased (A or B) and the number of hours that were used, and then displays the total charges. If the offer is different than A and B, or the number of hours is negative, then the message "wrong entry is displayed. Problemi #4: [20 pts] A library includes a list of books and has many copies of every book. Assume having an array named bookstore. Each element in the array represents a book and contains the number of copies of that book (cach book code is recognized by the array index). For example, if the array is A 1500 0 13 | 123 | 0 | 15 | 17 A[0]=500 means the book with code 0 has 500 copies. A[1]=13 means the book with code 1 has 13 copies, and so on. a) Write a method boolean borrow (int[] A, ini bookindex) that takes an array of integers A and a book's code then decreases the number of copies of that book by 1 (if there are available copies). The method returns true if the book is successfully borrowed. If there are no available copies (i.e value is zero), the method returns false, b) Write a program in which you create an array A of size 6 and fill it with numbers of your choice (you can use the shorthand array initialization). Assume all inputs are positive (do NOT check them in your program). Your program that asks the user to enter the book code (a positive integer), then invokes the above method. Check sample run below. Problem #3: (20 pts) a) Write a method that returns the difference of number of digits of two integers x and y. The method subtracts the number of digits in y from the number of digits in x and returns the value. public int Length(int x, inty) For example, if x=24598 and y=415, the number of digits in x is 5, and the number of digits in y is 3. Then the method returns 2 (that is 5-3). For example, if x-234 and y=784415, then the method returns -3 (that is 3-6). b) Write a test program that prompts the user to enter two integers. The program displays whether the first integer has more digits than the second one or less or both have the same number of digits. Problem #2: (20 pts Write a program that prompts the user to enter the size 'n' (ONLY positive) of an array 'a' and its integer elements. It also asks the user to enter an integer number x. The program should find the highest difference between x and each element in the array. For example, given the below array, and x=6 0 1 2 3 4 2 00 5 7 The differences are: 6-3=3 6-2=4 6-8=-2 6-5=1 6-7=1 The highest difference is 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
