Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new project in IntelliJ. Create a new class in the package named ConversionFunctions . (Right-click on the package you just created (under src)

  1. Create a new project in IntelliJ.
  2. Create a new class in the package named ConversionFunctions. (Right-click on the package you just created (under src) and select New->Java Class. Type the class name exactly as given and click OK.)
  3. Delete all the source code for ConversionFunctions.java and copy in the source code found here: Lab 4 ConversionFunctions Starting Source Code.
  4. Create an associated JUnit test class called ConversionFunctionsTest. See Create a JUnit Test Class in IntelliJ.
  5. Delete all the source code for ConversionFunctionsTest.java and copy in the source code found here: Lab 4 ConversionFunctionsTest Starting Source Code.
  6. Complete the TODOs in ConversionFunctionsTest, writing tests, and fixing bugs.

It is not required that you track this project in Git, but you may do so if you like. However, do not put this project in a public repository on GitHub.

/** * A library of conversion functions * * @author * @version 2018.04.14 */ public class ConversionFunctions { private static final String[] MONTH_NAMES = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; /** * Convert a temperature from celsius to fahrenheit * @param celsius temperature in degrees celsius * @return the fahrenheit equivalent of the given celsius temp */ public static int celsiusToFahrenheit(int celsius) { return (int)(Math.round(9.0*celsius/5) + 32); } /** * Convert cups to tablespoons. There are 16 tablespoons in a cup. * @param cups the number of cups to convert * @return the number of tablespoons in the given number of cups */ public static int cupsToTablespoons(int cups) { // This method does not work correctly. You will fix it as you work through the tests. // Remove these comments once it is implemented correctly. return 0; } /** * Convert a month number to the string name of the month * @param monthNum a month number, from 1 to 12 * @return the name of the given month, or empty string if the month number is invalid */ public static String monthNumToMonthName(int monthNum) { // This method does not work correctly. You will fix it as you work through the tests. // Remove these comments once it is implemented correctly. return MONTH_NAMES[monthNum]; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

b. Determine the 95% confidence intervals for the parameters.

Answered: 1 week ago