Write a Java program which takes as input the name of a file in the current...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Java program which takes as input the name of a file in the current directory. The first line of the file will contain an integer n, giving the number of posts along the river. The remaining n 1 lines of the file will contain the integers of the cost matrix, delimited by white space, omitting the unnecessary entries. For example, the matrix shown above could be represented by the following data file: 4 10 15 50 40 20 35 (Note that white space is not significant in the file.) Using a dynamic programming algorithm, your program will then compute the optimal costs of traveling between any two posts (i, j) where i <j. The goal is to determine the optimal cost for (0, n − 1). After performing that calculation, your program will print the optimal cost matrix: i.e. the optimal cost between any two posts (i, j) for all values 0 ≤ i ≤j≤n-1. Additionally, your program will print the actual sequence of rentals to be used for the route between posts 0 and n − 1 (not just its optimal cost). - Your program should use "good style". See the separate handout on style requirements for CS3310 programs. In particular, note that you should describe the algorithms you implement in sufficient detail to demonstrate your deep understanding of the algorithms in question. Additionally, you should create the following ordinary text files: ● README: Information on how to compile and run your program. • ANALYSIS: An analysis of your program, including: - A description of the (recursive) formula used to calculate the optimal costs be- tween posts A theoretical analysis of the run time of your program, formula Note that an empirical timing analysis is not required. based upon that recursive Write a Java program which takes as input the name of a file in the current directory. The first line of the file will contain an integer n, giving the number of posts along the river. The remaining n 1 lines of the file will contain the integers of the cost matrix, delimited by white space, omitting the unnecessary entries. For example, the matrix shown above could be represented by the following data file: 4 10 15 50 40 20 35 (Note that white space is not significant in the file.) Using a dynamic programming algorithm, your program will then compute the optimal costs of traveling between any two posts (i, j) where i <j. The goal is to determine the optimal cost for (0, n − 1). After performing that calculation, your program will print the optimal cost matrix: i.e. the optimal cost between any two posts (i, j) for all values 0 ≤ i ≤j≤n-1. Additionally, your program will print the actual sequence of rentals to be used for the route between posts 0 and n − 1 (not just its optimal cost). - Your program should use "good style". See the separate handout on style requirements for CS3310 programs. In particular, note that you should describe the algorithms you implement in sufficient detail to demonstrate your deep understanding of the algorithms in question. Additionally, you should create the following ordinary text files: ● README: Information on how to compile and run your program. • ANALYSIS: An analysis of your program, including: - A description of the (recursive) formula used to calculate the optimal costs be- tween posts A theoretical analysis of the run time of your program, formula Note that an empirical timing analysis is not required. based upon that recursive
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Read the case study about Solar clean purifying the future and write about price and product
-
Objective (1): Using Stack to match HTML tag in an HTML document, portions of text are delimited by HTML tags. A simple opening HTML tag has the form <name> and the corresponding Closing tag...
-
Write a report on Home and Automobile: These are two of the most important financial purchases we will make. These decisions, especially housing, will affect much of your ability to meet your...
-
Solve for the forces and reaction for the truss in Figure. Determine the matrix inverse for the system. Does the vertical-member force in the middle member seem reasonable?Why? 60 60 45 45 5000
-
All of the following statements are true concerning the conversion of governmental funds to governmental activities except a. Depreciation expenditure reported in governmental funds simply becomes...
-
Nereus Montemayor was an employee of VZ Hogs, a company that raises hogs and produces hog feed. VZ Hogs used an extruder manufactured by Sebright Products, Inc. to create hog feed out of discarded...
-
Elm Company had total assets of $640,000 in 2012, $680,000 in 2013, and $760,000 in 2014. In 2013, Elm had net income of $77,112 on revenues of $1,224,000. In 2014, it had net income of $98,952 on...
-
AVC Company sold 250 units on account for $ 1 comma 100 each. The standard cost of each unit is $ 800. Under a justminusinminustime costing system, the journal entries that are recorded for the 250...
-
Dominos Pizza franchises in New York were sued by the state of New York for wage theft at 10 stores. Under New York law, a corporation and a franchiser are joint employers if they meet certain...
-
The president of real-time Inc. has asked you to evaluate the proposed acquisition of a new computer. The computer price is $50,000 and it falls into MACRS-3 year class. The purchase of the computer...
-
q How can individuals enhance their productivity while working remotely, and what tools can facilitate a more efficient virtual work environment?
-
Identify and elaborate on a way in which analytics can benefit the sports world, and how it does or can deliver those benefits. Your example can come from any area of sports business, such as: In...
-
7. A billiard ball is shot east at 2.10 m/s. A second, identical billiard ball is shot west at 1.10 m/s. The balls has a glancing collision, not a head-on-collision, deflecting the second ball by 90...
-
Which decision-making bias is most likely to plague consensus decision making? Briefly explain.
-
Consider the n-channel E-MOSFET shown below. The process parameters are given as follows: Substrate doping density NA = 2 1015 cm-3 Source/drain doping density N = 1019 cm Gate oxide thickness...
-
In n 3. Use the integral test to find values of p for which the series is convergent: In x why the real valued function /(x)=- satisfies the hypothesis of the integral test. In particular you need to...
-
The following exercises are not grouped by type. Solve each equation. x610x -9
-
Repeat Exercise 18 in Chapter 1, but define and use named constants. Exercise 18 Write statements that can be used in a JavaFX application to draw the five interlocking rings that are the symbol of...
-
Suppose we want to implement a drawing program that creates various shapes using keyboard characters. Implement an abstract base class DrawableShape that knows the center (two integer values) and the...
-
Write a recursive method that will remove all the vowels from a given string and return what is left as a new string. Use the + operator to perform string concatenation to construct the string that...
-
See Table 2.5 showing financial statement data and stock price data for Mydeco Corp. a. Compute Mydecos PE ratio each year from 2019 to 2023. In which year was it the highest? b. What was Mydecos...
-
See Table 2.5 showing financial statement data and stock price data for Mydeco Corp. a. Compute Mydecos ROE each year from 2019 to 2023. b. Compute Mydecos ROA each year from 2019 to 2023. c. Which...
-
In early 2018, United Airlines (UAL) had a market capitalization of \($25.14\) billion, debt of \($12.73\) billion, and cash of \($5.59\) billion. United also had annual revenues of \($38.72\)...
Study smarter with the SolutionInn App