Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Alex
boolean method
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


I have a Noteook class. And I have one requirement is to promt user to select whether the notebook have bluetooth function or not? I don't know how to throw in the boolean method in my main class.

Notebook class as follow:
public class Notebook{

private String itemNo;
private double memory;
private double cost;
private int quantity;
private boolean blueTootEnabled;

public Notebook(String itemNo, double memory, double cost, int quantity, boolean BTE){
this.itemNo = itemNo;
this.memory = memory;
this.cost = cost;
this.quantity = quantity;
this.blueTootEnabled = BTE;

public String toString(){
String info = "\nItem No: "+itemNo;
info+="\nMemory: "+memory;
info+="\nCost: "+cost;
info+="\nQuantity: "+quantity;
info+="\nBlue Toot Enabled: "+true; //Currently was hard coded to make it true.
return info;
}

Below is main class method:
String itemNo = JOptionPane.showInputDialog("Please enter Item No: ");
double memory = Double.parseDouble
(JOptionPane.showInputDialog("Please enter memory: "));
double cost = Double.parseDouble
(JOptionPane.showInputDialog("Please enter cost: "));
int quantity = Integer.parseInt
(JOptionPane.showInputDialog("Please enter quantity: "));

Notebook n = new Notebook(itemNo, memory, cost, quantity,true);
boolean isAdded = jetas.buyNotebook(n);

if(isAdded==true) {
JOptionPane.showMessageDialog(null, " Notebook is added sucessfully!!!");
}
else { JOptionPane.showMessageDialog(null," FAILED! Item is not added. Identical notebook found");
}



Advertisement
View Answers

February 22, 2010 at 3:05 PM


Hi Friend,

Please send full code so that we can help you.
thanks


Related Tutorials/Questions & Answers:
boolean method - Java Beginners
don't know how to throw in the boolean method in my main class. Notebook...boolean method  I have a Noteook class. And I have one requirement... memory; private double cost; private int quantity; private boolean
Boolean DataType
Boolean DataType  What is the Size of the Boolean datatype in Java
Advertisements
boolean help
boolean help  Hi I'm kinda new to java and I'm trying to make... i give in, the boolean is always false and I don't know why. Maybe something... boolean access=false; public static String enterName() throws IOException
boolean operators in JavaScript
boolean operators in JavaScript  What boolean operators does JavaScript support
Boolean functions in JavaScript
Boolean functions in JavaScript  Explain about the Boolean functions present in Javascript
Boolean functions present in Javascript
Boolean functions present in Javascript   Explain about the Boolean functions present in Javascript
objective c boolean example
objective c boolean example  Hi, Can anyone tell me how to use boolean variable in Objective c? Thanks
Converting Boolean to String
); } } In the program, valueOf() method of String class is taking boolean type...Converting Boolean to String In this section we will discuss about how to convert boolean to String type. This example show you how to convert boolean type
MySQL Boolean
MySQL Boolean This example illustrates how to find the boolean value. In this example we create a select query to show if we pass 0 then it will return false but when we set 1 then it will return true.   Query
boolean comparisons - tutorial
.style1 { text-align: center; } Boolean Data Type Boolean data types... Statement and Boolean The  control statements like if, for, while and do all requires boolean value to execute. Generally operators are used
The boolean Keyword
The boolean Keyword       The boolean Keyword in java avails one of the two values that are true and false. Java have the boolean type so literal values true and false. 
changing final Boolean value in SwingUtilities.invokeLater()
changing final Boolean value in SwingUtilities.invokeLater()  Hi, I have a problem with setting final Boolean value in second time... static boolean doCommit() { final boolean success = true
Convert Boolean to String
type data into a string. The toString() method reads the Boolean type object... Convert Boolean to String       In this section, we are going to convert a Boolean type data
MySQL Boolean Value
MySQL Boolean Value       MySQl Boolean Value is used to display the Boolean type status of the field. Understand with Example The Tutorial illustrate an example from 'MySQL Boolean
Conversion from String to boolean
boolean type value. The parseBoolean() method coverts any type data to boolean...Conversion from String to boolean: In this tutorial we will learn how to convert a string type data to boolean type data. Description: This program
MySQL Boolean Data Type
MySQL Boolean Data Type This example illustrates how create a boolean data type. In this example we create a table 't' where define four field that is 'a' which is BOOL type, 'b' which is FLOAT type, 'c' which is LONG VARCHAR type
PHP Boolean Data Types
PHP Boolean Data Type: Boolean is one of the simplest data type supported by PHP. A boolean is used to express a truth value either true or false. For conversion to boolean data type, we need to use (bool) or (boolean) casts. Though
Conversion from short to boolean
Conversion from short to boolean: In this tutorial we will learn how to convert a short type data to boolean type. Description: This program will take a short type value from console and provides a conversion to boolean type
MySQL Boolean Operator
MySQL Boolean Operator This example illustrates how to use the boolean operator 'NOT' in the MySQL query. In this example we create a PROCEDURE 'boolproc' to find whether a=b or not. The procedure call by [call boolproc
MySQL Boolean Value
MySQL Boolean Value This example illustrates how to find the boolean type status of the table. In this example execute a query 'SHOW TABLE STATUS LIKE "%bool%"', it display the boolean type status of the field which is display
What is the difference between the Boolean & operator and the && operator?
What is the difference between the Boolean & operator and the && operator?   Hello, What is the difference between the Boolean & operator and the && operator? thanks
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
Conversion from int to boolean
Conversion from int to boolean: In this tutorial we will learn how to convert an int type value to boolean type data. Description: This program will take an int value from console and provide a conversion to boolean type data(true
Conversion from float to boolean
Conversion from float to boolean: In this tutorial we will learn how to convert a float type value to boolean type value. Description: This program will take a float value from console and provides a conversion to boolean type data
Conversion from double to boolean
Conversion from double to boolean: In this tutorial we will learn how to convert a double type value to boolean type value. Description: This program will take a double value from console and provide the conversion to boolean type
Conversion from byte to boolean
Conversion from byte to boolean: In this tutorial we will learn how to convert a byte type value to boolean type value. Description: This program will take a byte value from console and provides a conversion to boolean type data
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
Conversion from long to boolean
Conversion from long to boolean: In this tutorial we will learn how to convert a long type value to boolean type value. Description: This program will take a long type value from console and provide the conversion to boolean type
How to send boolean array to servlet from java application?
How to send boolean array to servlet from java application?  Hi, I want to send randomly generated array of boolean values. I used Random function and boolean array length to generate values. My question is I want to send
Need coding help - two dimensional matrix and it returns back a boolean.
Need coding help - two dimensional matrix and it returns back a boolean.  I need to write a code method that accepts a two dimensional integer arrays... triangular matrix. I need to be test this method using main method. If it is true
Java - Boolean Expression and Operation in Java
Java - Boolean Expression and Operation in Java       Boolean expression performs the relational or logical operations and returns the boolean value (True/False
Advertisements
 

 

 

DMCA.com