Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 20th November 2011
Linuxmania
Ceriwiser
 
Join Date: Nov 2011
Posts: 392
Rep Power: 14
Linuxmania mempunyai hidup yang Normal
Default [Ask - GRP Reward] Java Programming - Interactive Application using User Input

Hello semua,

G harus minta bantuan nih.



Nih prompt buat questionnya:.

a. Write a Java class that declares variable to represent the length and width of a room in feet. Assign appropriate values to the variables - for example, length = 15 and width = 25. Compute and display the floor space of the room in square feet. Display explanatory text with the value - for example, the floor space is 375 space feet. Save this class as Room.java



nah, kalo buat yg ini kan lebih mudah

ini jawaban gue


Code:

class Room {
public static void main(String[] args) {
int length, width, total;
length = 15;
width = 25;

total = length * width;

System.out.println("The floor space is " + total + " square feet.");

}
}

(betul ga yah?)



yg bagian kedua ini yg gue bingung:

b. Convert the Room class to an interactive application. Instead of assigning values to the length and width variables, accept them from the user as input. As output, echo the user's entries as well as displaying the floor space. Save the revised class as Room2.java



Please help. GRP Award menanti



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts