A parking lot charges $3 per hour for the first 10 hours of a 24 hour period. There is no further charge starting at the 11th hour and ending at the 24th hour. The charge for a full 24 hour period is therefore $30. The same pattern applies for periods longer than 24 hours. Write a program to calculate the cost in dollars, given the number of hours that the parking lot was used. public class Parking { public static void main(String[] args) { } // Change hours to get the answer for the those number of hours. int hours = 25; } int result = cost(hours); System.out.println(result); public static int cost(int hours) { int result = 0; // Write your code within the body of this method. return result;
Q: Write a function, called isSymmetric, which returns true if a directed graph is symmetric, false…
A: Dear student, the answer is provided below.
Q: Question 1 Which of the following decimal number has an exact representation in binary fixed-point…
A: Fixed-point Notation: Fixed-point notation has an implied binary point between the integer and…
Q: Question 15 A program consists of 100,000 instructions as follows: Instruction Type Integer…
A: Answer the above question are as follows
Q: Write a Java program for the given problem using Array. UTAS-IBRI wants to calculate the Final mark…
A: - We need to work with the student data.
Q: Which of the following is NOT an example of instantiating an object. a.Keyboard k; k = new…
A: Please check the step 2 for solution .
Q: Create a simple English Grammar in Python code using the parsimonious module. It needs to parse and…
A: Introduction Spacey is a Python NLP package that is open-source and free. It is created to produce…
Q: You need to measure distance between two binary strings. You want the strings to appear similar if…
A: Introduction: Below describe the to live distance between 2 binary strings. If the strings ar…
Q: 13. Given the OCaml F# function: let rec f function = 10-0 x 1: XS-> (x2) 11 f xs a) [1 b) (201 int…
A: Since you have posted multiple questions, we will provide the solution only to the first question…
Q: Explain what is common between a for loop, a while loop and a SQL statement. Explain your answer in…
A: Dear Student, The answer to your question is given below -
Q: In Prolog, which of the following pairs will successfully unify? Multiple answers possible. Negative…
A: In prolog unification, one or more variables give value to make two call terms identical and this…
Q: Question # 4: Use the Vigenere Cipher method to encrypt the following “PLEASE SEE ME TOMORROW”. Key…
A: Answer: We have explain in details how to use Vigenere Cipher method to encrypt the following so we…
Q: Anita prepare the bed now. I am sleepy. “one conservative father said during one of the evening…
A: Your answer is given below.
Q: You need to evaluate a set of propositions to solve the truth values of the propositions. You plan…
A: Answer the above question are as follows
Q: Which of these statements is true about the following code? int mystery(int n){ if (n>0) return n +…
A:
Q: protection
A: Solution - In the given question, we have to discuss the goals of protection.
Q: Implement the following: 1) Create a dictionary from the following data (the key is the name and the…
A: Algorithm: 1. Start 2. Create a dictionary dct with given data. 3. Initialize a variable sum_age and…
Q: I have a large number of string objects whose order is not really important, but I'd like to remove…
A: The solution is given below with explanation
Q: Translate the statement answer = ((one – onecase) * (two – twocase)) * (three – threecase) into…
A: We need to translate the statement answer = ((one – onecase) * (two – twocase)) * (three –…
Q: 4. Write a simple factorial calculator program. The program should perform the following: Step 1.…
A: Step-1: StartStep-2: Declare variable j=1Step-3: Start a loop till j is less than equal to 5…
Q: What do you think should be done to prevent, if not lessen these cases of computer abuse happening…
A: Computer literacy is crucial for success in today's society because computers and the Internet have…
Q: Previously, you had created a file to launch a dictionary attack on a target server without salt.…
A: In the past, you generated a file to conduct a dictionary attack against a server without salt. The…
Q: evaluate the postfix expressions. use the algoirthm to evaulate the postifx expressions. show full…
A: Solution: According to my calculations, the postfix expression 5 3 2 + / -3 - or a b c + / -3 -…
Q: uld optionally include a code for a meal plan. If t
A: PYTHON CODE:
Q: Given the following code: /*WhatGoesHere*/ someIterator = someType.begin(); while (someIter !=…
A: Introduction: The C compiler uses words with specific meanings as keywords. An identifier cannot be…
Q: MATA THEORY, I'LL DEFINITELY UPVOTE IF YOUR SOLUTION IS CORRECT!!! Use pumping lemma to show that…
A: Given language : L = {ambm+1cm}
Q: For an undirected graph with ? vertices and ? edges, what is the total degree of all the vertices?…
A: Answer Option C 2? The total degree of all the vertices in an undirected graph is equal to twice the…
Q: User Nurmeric notation, set the following permission on urname_file2 User:read ,write execute…
A: chmod is change directory or file permission command which is used to set permission level at user,…
Q: I need help fixing this python code so that it can display the output like shown below : matrixA =…
A: We need to rectify the given Python code to get intended output.
Q: Prove by an appropriate reduction that the following set is not recursively enumerable: {⟨M⟩|M(⟨M⟩)…
A: The Turing machine is a mathematical model that manipulates the abstract machine and computing…
Q: A UART transmission contains 8 data bits, 1 parity bit and 2 stop bits. If the baud rate is 9.6 kbps…
A: In this question we have been given some information related to a Universal Asynchronous…
Q: The central processing unit (CPU) of a computer may be designed in one of three different ways: with…
A: The component of the computer that gets and executes instructions is called the central processing…
Q: 1 2 3 De Morgan's Theorem is an example of the Rule of Replacement. Use a truth table to show that…
A: Introduction Identifying a path between 2 vertices (or nodes) inside a graph in which the sum of the…
Q: ch of the following is not a goal of Software Engineering: Make Complex Software/Systems Manageable.…
A: Dear Student, The answer to your question is given below -
Q: What are related valid iOS Terminal commands like cd .. or cd ../.. and their Windows or Linux…
A: Dear Student, The answer to your question is given below -
Q: Configurations for the operating system and applications are stored in what type of files? Text…
A: Configurations for the operating system and applications are stored in what type of files? Answer:…
Q: Write a function reg3 that, given x and y data vectors, fits a least-squares regression function of…
A: We need to write a function reg3 that, given x and y data vectors, fits a least-squares regression…
Q: Sora, Donald, and Goofy are currently on a mission where they have to rid different worlds off of…
A: dist = float(input("Distance to destination: ")) # ask user for distance to destination time =…
Q: Question 10 Write a program in Java that finds the Least common multiple of 2 numbers,please…
A: Algorithm for the code: 1. Start. 2. Initialize two variables n1, and n2. 3. Find the maximum number…
Q: Write a program that implements the FIFO and LRU page-replacement algorithms presented in this…
A: LRU and FIFO FIFO means First In, First Out, i.e., consider (in this case delete) elements…
Q: For the next 4 questions, analyze the following code segment: 01 i = 0 02 n = 1 03 04 while i <= 10:…
A: Explanation: The given code is going to print all prime numbers between 1 to 11. The first value of…
Q: The volume of any cylinder can be calculated using the following formula: volume = π * radius² *…
A: algorithm:- read value of r and h. if r>0 && h>0 v=3.1416*r*r*h display v…
Q: What is an SSL tunnel and what does it mean for a “tunnel” to be made between sites such as Render &…
A: proxy opens the connection between the client and the backend service and copies.
Q: Flowchart diagram shows occurence frequency of a variable. true or false?
A: A computer algorithm, system, or process is depicted in a flowchart. They are widely used in a…
Q: 1 2 3 5 6 6 7 Assume a = 5.0, b = 3.0, c = 2.0, and d = -3.0 Postfix expression: Step Expression a b…
A: Algorithm to evaluate the postfix expression 1) In stack, scan the character from left to right 2)…
Q: If a base class has a virtual member function named check(), and a pointer variable ptr of that…
A: Answer is attached in below step.
Q: Unix The file /usr/share/dict/words contains a list of "dictionary" words. Each word is on its own…
A: Introduction : Theory explains: The command to count the number of 3, 4, and 5-letter words from…
Q: MATLAB PLEASE Write a general binary search code that can find a target with multiple appear- ances…
A: MATLAB which it is a proprietary multi-paradigm programming language and numeric computing…
Q: In the context of the ensemble methods, explain how you would use the following concepts within the…
A: Max-voting, which is generally used for classification problems, is one of the simplest ways of…
Q: Golf scores record the number of strokes used to get the ball in the hole. The expected number of…
A: Your correct python program is given below with an output.
Q: To accurately categorize multiprocessor systems, one must have a thorough knowledge of the ways in…
A: A multiprocessor system is one that has many processors and a mechanism that gives them a way to…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- mport java.util.Scanner; public class ParkingCharges { // function to calculate the basic charge using the asked hours static double getBasicCharge(int hours) { if (hours >= 7 && hours <= 8) return 5.50; else if (hours >= 5 && hours <= 6) return 4.50; else if (hours >= 2 && hours <= 4) return 4.00; return 3.00; } // function to return the amount to subtract based on local living and OAP static double getDiscount(String isLocal, String isOAP) { if (isOAP.equals("Yes") && isLocal.equals("Yes")) return 2.0 + 1.0; else if (isOAP.equals("Yes")) return 2.0; else if (isLocal.equals("Yes")) return 1.0; return 0; } public static void main(String[] args) { // create a new Scanner object Scanner sc = new Scanner(System.in); // prompt the user to ask if they are disabled…Instructions Insurance.java >- Terminal + 1 import java.util.Scanner; sandbox $ 0 2 class Insurance { The Harrison Group Life Insurance company computes public static void main (String args[]) { // Write your code here annual policy premiums based on the age the customer 4 turns in the current calendar year. The premium is } computed by taking the decade of the customer's age, adding 15 to it, and multiplying by 20. 7 public static int calculatePremium(int curr, int birth) { 8 // Write your code here } For example, a 34-year-old would pay $360, which is calculated by adding the decades (3) to 15, and then 10 } 11 multiplying by 20. Write an application that prompts a user for the current year then a birth year. Pass both to a method that calculates and returns the premium amount, and then display the returned amount. An example of the program is shown below: Enter the current year >> 2020 Enter the birth year >> 2001 The premium is $320 Grading Write your Java code in the area on the…[Python Language] Using loops of any kind, lists, or Sets is not allowed. Sloan’s Book Collection Sloan loves reading books. She recently started reading an AI generated series called “Harry Trotter”. Sloan is collecting books from the series at her nearest bookstore. Since the series is AI generated, the publishers have produced an infinite collection of the books where each book is identified by a unique integer. The bookstore has exactly one copy of each book. Sloan wants to buy the books in the range [l,r], where l ≤ r. As an example, the range [−3,3] means that Sloan wants to buy the books − 3, − 2, − 1, 0, 1, 2, and 3. Pam also loves the series (or maybe annoying Sloan– who knows, really), and he manages to sneak into the bookstore very early to buy all of the books in the range [d,u], where d ≤ u. When Sloan later visits, sadly she will not find those books there anymore. For example, if Sloan tries to buy books [−2,3] and Pam has bought books [0,2], Sloan would only receive…
- In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Set the length of the rectangle to 24 and the width to 30.please code in python You place a pawn at the top left corner of an n-by-n chess board, labeled (0,0). For each move, you have a choice: move the pawn down a single space, or move the pawn down one space and right one space. That is, if the pawn is at position (i,j), you can move the pawn to (i+1,j) or (i+1, j+1). Ask the user for the size of a chessboard, n (integer). Find the number of different paths starting from (0,0) that the pawn could take to reach each position on the chess board. For example, there are two different paths the pawn can take to reach (2,1). Look at the diagrams below to convince yourself of this. You can see the four paths that you can take by move 2. Start -> Move 1 -> Move 2 (0,0) -> (1,0) -> (2,1) (0,0) -> (1,0) -> (2,0) (0,0) -> (1,1) -> (2,1) (0,0) -> (1,1) -> (2,2) Print the board with the number of ways to reach each square labeled as shown below. For example: Enter a board size: 4 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1Knight's Tour: The Knight's Tour is a mathematical problem involving a knight on a chessboard. The knight is placed on the empty board and, moving according to the rules of chess, must visit each square exactly once. There are several billion solutions to the problem, of which about 122,000,000 have the knight finishing on the same square on which it begins. When this occurs the tour is said to be closed. Your assignment is to write a program that gives a solution to the Knight's Tour problem recursively. You must hand in a solution in C++ AND Java. The name of the C++ file should be "main.cc" and the name of the Java file should be "Main.java". Write C++ only with a file name of main.cc Please run in IDE and check to ensure that there are no errors occuring Output should look similar to: 1 34 3 18 49 32 13 16 4 19 56 33 14 17 50 31 57 2 35 48 55 52 15 12 20 5 60 53 36 47 30 51 41 58 37 46 61 54 11 26 6 21 42 59 38 27 64 29 43 40 23 8 45 62 25 10 22 7 44 39 24 9 28 63
- JAVA CODE PLEASE Functions With No Parameters and Return Values Quiz by CodeChum Admin Create a function named banner that prints “CodyChum” with a newline. In the main function, write a program that accepts an integer input which would serve as an inclusive stopping point of a loop iteration that starts at the value of 1. If the number that loops through the range is divisible by either 2 or 3, then call the banner function, otherwise just print the number. Input 1. One line containing an integer Output First line is the integer user input. Succeeding multiple lines containing an integer or “CodyChum” 10 1 CodyChum CodyChum CodyChum 5 CodyChum 7 CodyChum CodyChum CodyChumJava Program: Recursive Method There are n people in a room where n is an integer greater then or equal to 2. Each person shakes hands once with every other person. What is the total number of handshakes in the room? Write a recursive method to solve this problem with the following header:public static int handshake(int n)where handshake(n) returns the total number of handshakes for n people in the room. To get you started if there are only one or two people in the room, then:handshake(1)=0handshake(2)=1Given the following: #includ int a[] ={4, 6}, i = 0, y =3, z =1; void f(int x){ int z = 2; g (); X = x + y; z = z +X; i++; return x + a[ i ]+y; } void g(){ z += 3; y = a[i] + z; } void main(){ printf("%d", y + f( a[i] ) - y); } State the output assuming the following: A) Call by reference, dynamic scoping, operands are evaluated right to left. B) Call by name, static scoping; operands are evaluated left to right.
- When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.public dlass examplemark public static void main(String args) on float studentmark=(46.56,65.78,89.91,100.00.75.55): studentmark[0]=56.46 system.out.printin"Student Mark"studentmark(0): Identify the mistakes/ errors in the above program and rewrite the full correct statement.