Answered step by step
Verified Expert Solution
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)
- 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) and select New->Java Class. Type the class name exactly as given and click OK.)
- Delete all the source code for ConversionFunctions.java and copy in the source code found here: Lab 4 ConversionFunctions Starting Source Code.
- Create an associated JUnit test class called ConversionFunctionsTest. See Create a JUnit Test Class in IntelliJ.
- Delete all the source code for ConversionFunctionsTest.java and copy in the source code found here: Lab 4 ConversionFunctionsTest Starting Source Code.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started