boolean method

boolean method

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");
}


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..._TO_REPLACE_1 static boolean access=false; public static String enterName() throws
Boolean functions in JavaScript
Boolean functions in JavaScript  Explain about the Boolean functions present in Javascript
boolean operators in JavaScript
boolean operators in JavaScript  What boolean operators does JavaScript support
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
Boolean functions present in Javascript
Boolean functions present in Javascript   Explain about the Boolean functions present in Javascript
ModuleNotFoundError: No module named 'boolean'
ModuleNotFoundError: No module named 'boolean'  Hi, My Python... 'boolean' How to remove the ModuleNotFoundError: No module named 'boolean... to install padas library. You can install boolean python with following command
objective c boolean example
objective c boolean example  Hi, Can anyone tell me how to use boolean variable in Objective c? Thanks
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
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
Convert Boolean to String
in converting the Boolean type data into a string. The toString() method reads the Boolean... Convert Boolean to String       In this section, we are going to convert a 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
boolean comparisons - tutorial
.style1 { text-align: center; } Boolean Data Type Boolean data types... if, for, while and do all requires boolean value to execute. Generally operators are used to evaluate a condition, which return boolean value. According
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.  ADS_TO_REPLACE_1
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. 
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 Value
MySQL Boolean Value       MySQl Boolean Value is used to display the Boolean type status of the field... 'MySQL Boolean Value'. To understand the example execute a query 'SHOW TABLE
ModuleNotFoundError: No module named 'Boolean-Solver'
ModuleNotFoundError: No module named 'Boolean-Solver'  Hi, My... named 'Boolean-Solver' How to remove the ModuleNotFoundError: No module named 'Boolean-Solver' error? Thanks   Hi, In your python
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
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
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 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
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
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
ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search'
ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search'  Hi...: No module named 'SQLAlchemy-boolean-search' How to remove the ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search' error? Thanks  
ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search'
ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search'  Hi...: No module named 'SQLAlchemy-boolean-search' How to remove the ModuleNotFoundError: No module named 'SQLAlchemy-boolean-search' error? Thanks  
ModuleNotFoundError: No module named 'boolean-cayley-graphs'
ModuleNotFoundError: No module named 'boolean-cayley-graphs'  Hi...: No module named 'boolean-cayley-graphs' How to remove the ModuleNotFoundError: No module named 'boolean-cayley-graphs' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-boolean-sum'
ModuleNotFoundError: No module named 'django-boolean-sum'  Hi, My... named 'django-boolean-sum' How to remove the ModuleNotFoundError: No module named 'django-boolean-sum' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-boolean-switch'
ModuleNotFoundError: No module named 'django-boolean-switch'  Hi...: No module named 'django-boolean-switch' How to remove the ModuleNotFoundError: No module named 'django-boolean-switch' error? Thanks   Hi
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 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
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 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
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
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
method inside the method??
method inside the method??  can't we declare a method inside a method in java?? for eg: public class One { public static void main(String[] args) { One obj=new One(); One.add(); private static void add
get method
get method   how to use get method: secure method is post method and most of use post method why use a get method
Method
Method       In this section, we will explore the concept of method in the reference of object oriented... and behaviors are defined by methods. Method : An brief introduction Methods
method question
method question  How do I figure out the difference in a method heading, a method body, and a method definition
Method Overloading
Method Overloading  In java can method be overloaded in different class
Method Overloading
Method Overloading  In java can method be overloaded in different class
A method getColumnCount.
A method getColumnCount.  There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set
abstract method
abstract method  is final method is in abstract class
Static method
Static method  what is a static method?   Have a look at the following link: Java Static Method
gc() method
gc() method  what is difference between java.lang.System class gc() method and java.lang.Runtime class gc() method
method name
method name  Is there any method which is equivalent to c++'s delay(int) function
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
main method
main method  Why is the java main method static

Ads