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




Have Programming Question? Ask it here!
 
 
 


Alex
boolean method
1 Answer(s)      4 years and 2 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
are writing your own boolean method, starting the name with "is" is a good... Java NotesBoolean The primitive type boolean has only two possible values: true and false. Boolean literals - true and false The two values
Advertisements
Boolean DataType
Boolean DataType  What is the Size of the Boolean datatype in Java
Boolean Expressions
Boolean Expressions Name ______________________ Assume the following: int k = 10; int j = 6; boolean b = true; Show what is printed by each of the following statements. __________ System.out.println( 1 > 2
Boolean Expressions
Boolean Expressions Name ______________________ Assume the following: int k = 10; int j = 6; boolean b = true; Show the value (true or false) of each of the following expressions. __________ 1 > 2 __________ b __________ k
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 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
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
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
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
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
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
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
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
Java: Boolean Expression Answers
Java NotesBoolean Expression Answers Name ______________________ Assume the following: int i, j, k; boolean b; k = 10; j = 6; b = true; Give the values of the following expressions, or illegal. 1trueb 2false!b 3true!!!!!!b 4trueb
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
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 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 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
method   how and where, we can define methods ? can u explain me with full programme and using comments
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
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
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
PHP Boolean Variables
PHP Variables Boolean In PHP we have different kinds of data types... which is called Boolean data type. It is a primitive data type having either true...; Boolean in different way. For example : <?php $age = true; //assign
How to do Null validation for a boolean variable - Java Beginners
How to do Null validation for a boolean variable  How to do Null validation for a boolean variable in JAVA?  Hi friend, For solving the problem visit to : http://www.roseindia.net/java/master-java/variables
String.equals()
In Java programming language, equals() is method of string class that is used for comparison between two objects. It always returns the output in Boolean value "true or false". You can use the method to check the equality
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
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
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
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?
static boolean portion at the bottom... any ideas?  heres my code import...; boolean guess = true; System.out.print("The Number guessing game... static boolean playAgain(){ String answer
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
Advertisements
 

 

 

DMCA.com