classes and data abstraction

classes and data abstraction

View Answers

January 8, 2009 at 3:32 AM

Hi friend,


I am sending java code according to your requirement. Please implement following code.


public class Exchange {

private String type;
private double amount;
private int convert;

public Exchange() {

}

public void setType(String type){
this.type = type;
}

public String getType(){
return type;
}

public void setAmount(double amount){
this.amount = amount;
}

public double getAmount(){
return amount;

}

public void setConvert(int convert){
this.convert = convert;
}

public int getConvert(){
return convert;
}
}
-------------------------

January 8, 2009 at 3:33 AM

import java.io.*;

public class ExchangeDemo {

public static void main(String args[]) throws IOException{

Exchange ex = new Exchange();
System.out.println("U S doller currency Amount Example!");
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
String str="y";
while(str.equals("Y")||str.equals("y")){

System.out.println("Please enter currency type!");
String a = buff.readLine();
ex.setType(a);

System.out.println("Please enter u s amount!");
double b = Double.parseDouble(buff.readLine());
ex.setAmount(b);
System.out.println("U S doller currency " + b);

System.out.println("Please enter convert amount!");
int c = Integer.parseInt(buff.readLine());
ex.setConvert(c);

System.out.println("doller type currency :" +ex.getType());
System.out.println("U S doller currency :" + ex.getAmount());
System.out.println("Exchange currency :" + ex.getConvert());

System.out.print("would you like to Continue y or n:");
str=buff.readLine();
}
}
}

-------------------------------------------------------

Visit for more information:

http://www.roseindia.net/java/language/inheritance.shtml

Thanks.









Related Tutorials/Questions & Answers:
classes and data abstraction - Java Beginners
classes and data abstraction  Create a java program for a class named Exchange that contains data member methods that meet the criteria...() is called. If the user enters 'q', the data member more is set to false to allow
online classes for data science
online classes for data science  Hi, I am beginner in Data Science... classes for data science Try to provide me good examples or tutorials links so that I can learn the topic "online classes for data science". Also
Advertisements
data analytics classes online
data analytics classes online  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... that I can learn the topic "data analytics classes online". Also tell me
data science classes
data science classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science classes Try to provide me good examples or tutorials links so that I can learn
data analytics classes
data analytics classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data analytics classes Try to provide me good examples or tutorials links so that I can learn
data scientist classes
data scientist classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data scientist classes Try to provide me good examples or tutorials links so that I can learn
data science online classes
data science online classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science online classes Try to provide me good examples or tutorials links so that I
abstraction
abstraction  give a simple example program for abstraction   public class Animal { double energyReserves; boolean isHungry() { return... is an abstraction used in place of an actual animal
abstraction
abstraction  give a simple example program for abstraction  ... is an abstraction used in place of an actual animal.*/   public class Animal...); } } } /*In the above example, the class Animal is an abstraction used in place
data science classes near me
data science classes near me  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science classes near me". Also tell me
data analytics classes near me
data analytics classes near me  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... that I can learn the topic "data analytics classes near me". Also tell
Abstraction in Java
Abstraction in Java Abstraction is one of the four pillar of OOPS Concept. Abstraction in java is a process by which hiding the irrelevant data  and exposing only the essential feature of object. In java Abstraction
Abstraction In Java
with the variables.ADS_TO_REPLACE_1 There are two types of Abstraction Data Abstraction : In the data abstraction only the meaningful operation is exposed and all...Abstraction In Java In this section we will read about the abstraction in Java
What classes should I take if I want to become a data scientist?
What classes should I take if I want to become a data scientist?  Hi... for the tutorials to learn: What classes should I take if I want to become a data... learn the topic "What classes should I take if I want to become a data
What is Abstraction In Java?
What is Abstraction In Java?  Hi, What is Abstraction In Java? How to use the Abstraction In Java to write program? Thanks   Hi, Suppose... it for other developer. In case you won't want anyone to modify the data or logic
Abstraction in flex
Abstraction in flex  Hi... What keyword allows you to implement abstraction better? please tell me about it.... ThanksADS_TO_REPLACE_1   Ans: Flex does not support abstart class directly. ThanksADS_TO_REPLACE_2
What is Abstraction - Java Beginners
What is Abstraction  What is abstraction in java? How is it used in java..please give an example also  Hi Friend, Abstraction is nothing but data hiding.It involves with the dealing of essential information
how to do abstraction for insurance policy being issued...
how to do abstraction for insurance policy being issued...  an insurance policy is being insured.... now what will be the classes for policy and how to do abstraction of the same
ModuleNotFoundError: No module named 'abstraction'
ModuleNotFoundError: No module named 'abstraction'  Hi, My Python... 'abstraction' How to remove the ModuleNotFoundError: No module named 'abstraction' error? Thanks   Hi, In your python environment
Difference between Encapsulation and Abstraction in Java
and Abstraction in Java. Encapsulation is a process of hiding all the data and methods within a class from outside world. Abstraction on the other hand... and protected access modifier. It wraps the variables, method data and codes within
Java abstraction - Java Beginners
Java abstraction  what is abstraction in java please explain with example  Hi, Abstract Class Abstract classes are those that works... the methods inherited from the abstract class (base class). Abstract classes
Java abstraction - Java Beginners
Java abstraction  Is abstraction and abstract class are related ar same
encapsulation vs abstraction
encapsulation vs abstraction  what is the difference between encapsulation and abstraction
Abstraction In Java for Java beginners
Abstraction In Java for Java beginners  Hi, As a beginner in Java I am looking for good tutorial that explains the Abstraction concept in Java... of Abstraction in Java? Thanks   Hi, What is abstraction in Java
Abstraction : Java Glossary
Abstraction : Java Glossary   .... Encapsulation 2. Polymorphism 3. Abstraction 4. Inheritance In OOPs, these concepts... creation process, programmatically. Here we will discuss Abstraction briefly
Wrapper Classes
Wrapper Classes        In this section you will learn about Wrapper classes and all the methods that manipulate data and allows to operate a certain work. Wrapper class
diff between encapsulation and abstraction code
diff between encapsulation and abstraction code  diff between encapsulation and abstraction code
Java Data Objects
Java Data Objects       The Java Data Objects (JDO) API is a specification of Java model abstraction... to the domain model. JDO persistent objects are simple java classes therefore
Abstraction in java - Java Interview Questions
Abstraction in java  Abstraction in java - I know its a very basic question that i can find anywhere else as well... but i am looking for a description as well as an example on Abstraction in java. can anyone
Encapsulation & Abstraction - Java Interview Questions
Encapsulation & Abstraction  What is the difference between Encapsulation and Abstraction
Encapsulation & Abstraction - Java Interview Questions
Encapsulation & Abstraction  What is the difference between Encapsulation and Abstraction
wrapper classes
wrapper classes  Explain wrapper classes and their use?   Java Wrapper Class Wrapper class is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g.
Encapsulation VS Abstraction - Java Beginners
and Abstraction. where to use abstract and where to use specifies like public... of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way
Spring Abstraction with Redis
Spring Abstraction with Redis  Hi.. I have implemented @Cacheable for one method like @Cacheable("parameter1") public String getCompaniesList(String parameter1, String parameter2) throws Exception { //code
ModuleNotFoundError: No module named 'project-abstraction'
ModuleNotFoundError: No module named 'project-abstraction'  Hi, My... named 'project-abstraction' How to remove the ModuleNotFoundError: No module named 'project-abstraction' error? Thanks   Hi
ai classes
ai classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ai classes Try to provide..., Artificial Intelligence and Data Science for beginners. Thanks   
ml classes
ml classes  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ml classes Try to provide..., Artificial Intelligence and Data Science for beginners. Thanks   
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
Collection classes in java
is the reason using java collection classes saved/stored the data/content.I don't.... Or the data is stored in both database and java collection classes...Collection classes in java   Normally a database is used
Collection classes in java
is the reason using java collection classes saved/stored the data/content.I don't.... Or the data is stored in both database and java collection classes...Collection classes in java   Normally a database is used
How to make query and abstraction in Java
How to make query and abstraction in Java  Hi, I read the lessons you have in the sites. They are really useful. However, I could not write codes... PostgreSQL database, and I want to make a query and abstraction for a table. Could
Abstraction in Java 7
Abstraction in Java 7 This section elaborate about abstraction. It is one of OOPs concept. Abstraction :  Abstraction means hiding the unnecessary... or object.  In java, you can see concept of abstraction whenever you use
Java classes
Java classes  Which class is extended by all other classes
DAO Classes
DAO Classes  login page code for Dao classes
java classes
java classes  Which class is the super class for all classes in java.lang package
ModuleNotFoundError: No module named 'object_store_abstraction'
ModuleNotFoundError: No module named 'object_store_abstraction'  Hi...: No module named 'object_store_abstraction' How to remove the ModuleNotFoundError: No module named 'object_store_abstraction' error? Thanks  
ModuleNotFoundError: No module named 'osm-bot-abstraction-layer'
ModuleNotFoundError: No module named 'osm-bot-abstraction-layer'  Hi...: No module named 'osm-bot-abstraction-layer' How to remove the ModuleNotFoundError: No module named 'osm-bot-abstraction-layer' error? Thanks  
ModuleNotFoundError: No module named 'python-sql-abstraction'
ModuleNotFoundError: No module named 'python-sql-abstraction'  Hi...: No module named 'python-sql-abstraction' How to remove the ModuleNotFoundError: No module named 'python-sql-abstraction' error? Thanks   Hi

Ads