Hey, I'm a student wanting help on how to write a program in netbeans.. I have no idea how to work this website so this question may be in the wrong place but.. here goes:
so i need to write a program that outputs a quote one letter at a time in a line.. like this:
h
e
l
l
o
!
h
o
w
a
r
e
y
o
u
?

got it??
okay thanks!!!

Hey, I'm a student wanting help on how to write a program in netbeans.. I have no idea how to work this website so this question may be in the wrong place but.. here goes:
so i need to write a program that outputs a quote one letter at a time in a line.. like this:
h
e
l
l
o
!
h
o
w
a
r
e
y
o
u
?

got it??
okay thanks!!!

We don't write programs for people. That's not how the site works. You write the program and when you get stuck, post your code and a specific question, and we try to nudge you in the right direction.

So give it a shot and when/if you get stuck, post your attempt.

Investigate and learn about the following:

Loops, in particular loops that increment an integer variable
The String class, in particular the charAt method
Printing to System.out

Give it a try, and when you get stuck come back here.

Edited 7 Years Ago by JamesCherrill: n/a

//Create a string and initialize it to some string literal

for i = 0 to i less than the string.size ; i++)
//use string.charAt(i) to print  + "\n";

Heyy guyss i would REALLY Appreciate if you could please tell me how to do this.
I need to create a program which will take 5 dollar amounts from the user (keyboard) and output the total entered. The program should have output that looks like the following:
$5.34
$10.62
$0.25
$148.23
Total: $164.43

Heyy guyss i would REALLY Appreciate if you could please tell me how to do this.
I need to create a program which will take 5 dollar amounts from the user (keyboard) and output the total entered. The program should have output that looks like the following:
$5.34
$10.62
$0.25
$148.23
Total: $164.43

- make 5 variable, or arrays.
- Make a total variable. initialize it to 0;
- ask user to input 5 times
- make total += input1, total += input2 ...

[Example]

Scanner read = new Scanner(System.in);
float Total = 0.0f;
float input1 = 0;
float input2 = 0;
input1 = read.nextInt();
Total += input1;
input2 = read.nextInt();
Total += input2;
System.out.print("Total is = " + Total + "\n");
import java.text.DecimalFormat;
import java.util.Scanner;

public class AdditionDoublePrecision {
	public void getdoublePreVal(double dob) {
		DecimalFormat format = new DecimalFormat();
		format.setMinimumFractionDigits(2);
		format.setMaximumFractionDigits(2);
		System.out.println("Total $: " + format.format(dob));
	}

	public static void main(String[] args) {
		double addition = 0;
		System.out.println("Enter 5 doller values : ");
		Scanner read = new Scanner(System.in);
		addition = read.nextDouble() + read.nextDouble() +  read.nextDouble()
				+ read.nextDouble() + read.nextDouble();
		AdditionDoublePrecision precision = new AdditionDoublePrecision();
		precision.getdoublePreVal(addition);
	}
}

SNIP

Edited 7 Years Ago by happygeek: spam deleted

This article has been dead for over six months. Start a new discussion instead.