Create a Console application for a library and name it FineForOverdueBooks.
The Main( ) method asks the user to input the number of books that are overdue and the number of days they are overdue. Pass those values to a method that displays the library fine, which is 10 cents per book per day for the first seven days a book is overdue, then 20 cents per book per day for each additional day.
Grading criteria
1. Create a Console application. In the Main( ) method, the user is prompted to enter the number of books that are overdue, and then the number of days they are overdue.
2. Create a user-defined method to compute the fine for overdue books. This method will receive the number of overdue books and the number of days the books are overdue as parameters from the Main( ) method. Then this method will calculate the fine and display it.
3. Compile and test the program to make sure there is no syntax error. Submit the completed program in a .zip file.
FineForOverdueBooks.java
import java.util.Scanner;
public class FineForOverdueBooks {
public static void main(String[] args) {
//Declaring variables
int noOfOverdueBooks, noOfOverdueDays;
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
//Getting the input entered by the user
System.out.print("Enter the number of books that are overdue :");
noOfOverdueBooks = sc.nextInt();
System.out.print("Enter the number of days they are overdue :");
noOfOverdueDays = sc.nextInt();
//calling the method
double fineAmt = calculateFine(noOfOverdueBooks, noOfOverdueDays);
//Displaying the output
System.out.println("Total Fine Amount :$" + fineAmt);
}
/* This method will calculate the fine amount based
* on no of overdue days and no of overdue books
*/
private static double calculateFine(int noOfOverdueBooks,
int noOfOverdueDays) {
double fineAmt = 0.0;
if (noOfOverdueDays <= 7)
fineAmt = noOfOverdueBooks * 0.10;
else if (noOfOverdueDays > 7)
fineAmt = 7 * 0.10 + (noOfOverdueDays - 7) * 0.20;
return fineAmt;
}
}
____________________
Output:
Enter the number of books that are overdue :6
Enter the number of days they are overdue :22
Total Fine Amount :$3.7
_______________Could you plz rate me well.Thank You
Create a Console application for a library and name it FineForOverdueBooks. The Main( ) method asks...
Write a C# console application that has one method to perform the four basic arithmetic operations of add, subtract, multiply, and divide. In the main program, first print a line on the console showing your name. Call the method you created above with each of the four arithmetic operations. You have to pass the method two integer numbers as well as a flag for which operation you want the method to perform. The method performs the operation on the numbers...
Create the following programs in Java {Java1 difficulty} [Please create as simple as possible] a. Ask the user to enter their favorite number and favorite word. Pass both of these values to a method that will print the favorite word vertically the favorite number of times. b. Ask the user to enter 2 integers. Pass the integers to 2 different methods: one method to add the integers and print the sum (from the method); the second method to multiply the...
Create a C# console application that performs the following: 1) Build a method which reads 3 integers from the console and returns them as an int array (type a number, then hit enter, 3 times). This needs to be its own method. 2) Call this method twice to store 2 local int array variables. 3) Once both arrays are built, write another method which accepts the two arrays and compares the contents to see if they match. If the method...
Create a C# console application that performs the following: 1) Build a method which reads 3 integers from the console and returns them as an int array (type a number, then hit enter, 3 times). This needs to be its own method. 2) Call this method twice to store 2 local int array variables. 3) Once both arrays are built, write another method which accepts the two arrays and compares the contents to see if they match. If the method...
Weather Program Create an application to interacts with a web service in order to obtain data. Program must prompt the user for their city or zip code and request weather forecast data from OpenWeatherMap (https://openweathermap.org). Program must display the weather information in a READABLE format to the user. Requirements: Create a header for your program just as you have in the past. Create a Python Application which asks the user for their zip code or city. Use the zip code...
We use JAVA. Thanks. Create an application whose main method asks the user to enter an n by m integer matrix that contains nm integer numbers. n and m should be between 1 and 10. If the user enters a number less than 1 or greater than 10, the program will continue to ask the user to enter an integer number between 1 and 10. The program should print the sum of the boundary elements of the matrix....
Please help me with these two problems. Thank you. Part A Create a console-based application that prompts the user to enter the total price of the transaction as well as a sale or discount percentage, then returns the price of the transaction with the percentage discount applied. You should create at least one method that accepts and returns data. Part B Create a console-based application named MealPrice that computes the price of a meal at a pirate-themed restaurant owned by...
In this assignment you will implement software for your local library. The user of the software will be the librarian, who uses your program to issue library cards, check books out to patrons, check books back in, send out overdue notices, and open and close the library. class Calendar We need to deal with the passage of time, so we need to keep track of Java. Declare this variable as private int date within the class itself, not within any...
The Task: Create a console application that prompts the user to select either a stack, queue, linked list, or binary search tree. Then prompt the user for a number that will then be passed to a recursive function that will populate an array in ascending order. If user selected binary search tree, they will then be prompted to choose how the data will be received either in-order, preorder, or post-order. If user selected linked list, they will then be prompted...
// C programming
Create a system managing a mini library system. Every book corresponds to a record (line) in a text file named "mylibrary.txt". Each record consists of 6 fields (Book ID, Title, Author, Possession, checked out Date, Due Date) separated by comma: No comma '', "in title or author name. This mini library keeps the record for each book in the library. Different books can share the book "Title". But the "Book ID" for each book is unique. One...