Question: Please help me to write the code for those problems. My code is here, but I don't know how to do for rounding public int

Please help me to write the code for those problems.

My code is here, but I don't know how to do for rounding

public int roundDollars(String amountStr)

{

int result = 0;

amountStr = amountStr.replace(".","").replace("$","").replace(",","").trim();

//maybe round should be here?

result = Integer.parseInt(amountStr);

return result;

}

Also, please help me with other problems,15 and 16.

Please help me to write the code for those problems. My code

14THE ROUNDEDDoLLArs PROBLEM Write the method named roundDollars(). The method has one input, a String named amountStr which consists of a dollar-formatted amount, such as "$ 1,256.86". The returned value is an int representing the number of rounded "dollars" in the amount (1257) in the sample shown here. You will need to scrub, format and parse the input, then use arithmetic to determine how many quarters the amount contains. 15THE LINENUMBER PROBLEM Write the method named lineNumber(). The method has two parameters, an int named number and a String named text. Return a formatted string where number is right-justified in a field 5 characters wide, followed by a colon and space, followed by the text. For example: lineNumber (5, "Orange Coast College")* "5: Orange Coast College" 16THE LINEITEM PROBLEM Write the method named lineItem() that formats an item on a receipt. The method has two parameters, a String description and a double price. Return a formatted string where description is left-aligned in a column 15 wide and price is right-aligned in a column 10 wide with two decimals. Thousands should be separated by commas but there should be no dollar sign. For example: lineItem("Toaster", 24)"Toaster 24.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!