Overview
The purpose of this assignment is to gain experience writing in Java.
Details
Your instructor may ask you to implement code for this laboratory assignment in IntelliJ or CodingBat. Be sure to follow your instructor's instructions.
Negate
Given a number, return its negative.
How Many Pennies
Given a number representing dollars and cents, e.g. 2.18, return the number of pennies corresponding to that amount.
Last Half
Given a non-empty string with an even number of characters, return the last half. E.g., Given "this" return "is".
Make Initialization
Make a program that writes a line of Java code. Given the name of the variable and its value, return an initialization of an int with that name and value. E.g., given the name "x" and the value "5", return "int x = 5;"
Fraction
Given a fraction expressed as a numerator and denominator, return the fraction as a floating point number.
Sample Console Interaction
If you are required to use IntelliJ for your implementation, your program interaction should look like this:
1. Negate Enter an integer value: -3 Result: 3 2. How Many Pennies Enter a dollar amount: 2.18 Result: 218 3. Last Half Enter a word: this Result: is 4. Make Initialization Enter a name: x Enter an integer value: 5 Result: int x = 5; 5. Fraction Enter a numerator: 1 Enter a denominator: 2 Result: 0.5
Acknowledgement
This laboratory assignment was developed by Dr. Chris Taylor and Dr. Josiah Yoder.
Lab Deliverables
See Prof. Jones for instructions
Dr. Taylor's class: complete in codingbat.com; Due 11pm the day of lab
See Prof. Contino for instructions
See Dr. Thomas for instructions