Java Programming/Q&A

Welcome to the Java Programming questions and answers page.

Feel free to post any questions you have while learning Java Programming. If you have questions about this book, post them on the Java Programming discussion page. If you know the answer to a question, or you can improve any, go ahead and do it.

Programming code..
What is the code that one can use in java to display height in feet (int) and inches(int)?

(!)Why does this not work plz help ASAP(!)
import java.util.Random; import java.util.Scanner; class Main { public static void main (String[]args) {   Scanner scanner = new Scanner (System.in);

Random random = new Random ; {     int rock = 0; int paper = 0; int scissors = 0; int loop = 0; int no = 0;

while (loop == 0)

no = random.nextInt (3) + 1;

if (no == 1) rock = 1;

if (no == 2) paper = 1;

if (no == 3) scissors = 1; }   System.out. println ("Pick rock paper scissors\nRock = 1 Paper = 2 Scissors = 3: "); int cho = scanner.nextInt ; {     if (cho == 1 & no == 3 | cho == 2 & no == 1 | cho == 3 & no == 2) {	 System.out.println ("You Win"); loop++; }     if (cho == 1 & no == 2 | cho == 2 & no == 3 | cho == 3 & no = 1) {	 System.out. print ("You loose want to play again? Type 0 to play again or type 1 to Exit: "); loop = scanner.nextInt ; }     if (cho == 1 & no == 1 | cho == 2 & no == 2 | cho == 3 & no == 3) System.out.println ("Tie try again"); } } }

Java
Write a program that calculates the current checking account balance, based on user input.

Inputs:

Ask user for account number and name.

Ask user for opening balance.

Ask user for up to 5 debit transactions, user can stop entering by typing -1.

Ask user for up to 5 credit transactions, user can stop entering by typing -1.

Processing:

Calculate new balance.

Output:

[Account number] - [Customer first name] [Customer last name]

Original Balance: [Original balance]

Debits: [Number of debits]

Debit Total: [Debit total]

Credits: [Number of credits]

Credit Total: [Credit total]

Balance: [Current account balance]