No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
6 Posted Topics
Why don't you just use the package ...... import java.text.NumberFormat; then use this in the body....... NumberFormat money = NumberFormat.getCurrencyInstance(); lastly print out in the body ....... System.out.println(money.format(dollars)); Idk if this is what you were looking for, but this is a very simple version of getting the 2 decimal places.
Sigh, if you want the whole code, ask for it...Since it's pretty long. But this is HOW to solve it. I'm sure you can follow this to find the answer. [CODE] main() Prompt the user for a number while (number != -1) { if (isValidNumber(number)) { getLetterGrade(number) Display message with …
Try using multiple methods... and make sure your LOGIC makes sense (Write it out and make sure it makes sense before you go into coding). If you post your code I can help.
Hey, getting a new error in my code... Its almost done, cant figure out what is wrong with this. ERROR: non-static method isPrime(int) cannot be referenced from a static context [CODE] import java.util.Scanner; public class primenumbertest { public boolean isPrime(int x){ int divisor = 1; do{ divisor += 1; } …
[CODE] import java.util.Scanner; public class primenumbertest { public boolean isPrime(int num){ int x; Scanner input = new Scanner(System.in); System.out.print("Enter a number to find out if it's prime or not (greater than 1): "); num = input.nextInt(); if (num == 2) return true; // check for divisible by all even number …
The End.
GTJava