|
|
| OOP Using JAVA |
Expert:sassy
OBJECT ORIENTED PROGRAMMING USING JAVA (hope guys u will help me please i need your help,thank you so much)
Create a Java program for a class named Money that contains data members.This class is used to identify the type of currency by a character code and amount.The non-static char data member named currencyType and a double data member named currencyAmount should be public members so that they can be accessed outside of the class.
THIS IS A BOX COULD BE BOX JUST A FORMATION OF A CODE(HARD TO DRAW) ___________________________ Money ___________________________ +currencyType:char +currencyAmount:double ___________________________
___________________________
HOPE GUYS YOU WILL HELP ME |
| Answers |
Hi friend,
Code to help in solving the problem :
import java.io.*;
class OOPStringChar { public void OopType() throws IOException{ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Curreny Amount"); double currencyAmount= Double.parseDouble(br.readLine()); System.out.println("currencyAmount " + currencyAmount); System.out.println("Enter Character"); char currencyType = (char) System.in.read(); System.out.println("currencyType " + currencyType);
} catch(Exception e){ System.out.println("Out of range!"); } }
}
public class StringMain { public static void main(String args[]) throws IOException { OOPStringChar oops = new OOPStringChar(); oops.OopType();
}
}
For more information on Java visit to :
http://www.roseindia.net/java/
Thanks
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|