Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Linuxmania Linuxmania is offline
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



Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 10:41 PM.


no new posts