Translating Boolean true/false into Yes/No of what I am doing wrong
Having a hard time figuring out how to translate this. Here is the method I think should do it:
instance variable: private boolean isPaperback;Method:
public void translate(boolean trueOrFalse)
if (isPaperback = true) {
System.out.println("Yes");
else {
System.out.println("No");
}When I run the method, it gives me an answer of "Yes" for both true and false. Any idea of what I am doing wrong?
TIA, Marc
Edited by: Celtica on Feb 9, 2009 12:33 AM
Edited by: Celtica on Feb 9, 2009 12:34 AM
here is the code of the program:
public class Book
// instance variables
private String title;
private String author;
private String isbn;
private int numberOfPages;
private boolean isPaperback;
private double price;
* Constructor for objects of class Book
public Book(String theTitle, String theAuthor, String theIsbn,
int theNumberOfPages, boolean theIsPaperback,
double thePrice)
// initialise instance variables
title = theTitle;
author = theAuthor;
isbn = theIsbn;
numberOfPages = theNumberOfPages;
isPaperback = theIsPaperback;
if (price < 0.00) {
double price = 0.00;
else {
price = thePrice;
* Display the title
public String getTitle()
// put your code here
return title;
* Display the Author
public String getAuthor()
// put your code here
return author;
* Display the ISBN
public String getIsbn()
// put your code here
return isbn;
* Display the Number of pages
public int getNumberOfPages()
// put your code here
return numberOfPages;
* Display the isPaperback Status
public boolean getIsPaperback()
return isPaperback;
* Display the price
public double getPrice()
return price;
* set the title
public void setTitle(String newTitle)
// put your code here
title = newTitle;
* Set the Author
public void setAuthor(String newAuthor)
// put your code here
author = newAuthor;
* Set the ISBN
public void getIsbn(String newIsbn)
// put your code here
isbn = newIsbn;
* Set the Number of pages
public void setNumberOfPages(int newNumberOfPages)
// put your code here
numberOfPages = newNumberOfPages;
* Set the isPaperback Status
public void setIsPaperback(boolean newIsPaperback)
// put your code here
isPaperback = newIsPaperback;
* set the Price
public void setPrice(double newPrice)
// put your code here
price = newPrice;
* Returns the string "Yes" if passed true, and "no" if passed false
public void translate(boolean trueOrFalse)
if (isPaperback = true) {
System.out.println("Yes");
else {
System.out.println("No");
* Displays book information
public void displayBook()
System.out.println("Title: " + title);
System.out.println("Author: " + author);
System.out.println("ISBN: " + isbn);
System.out.println("Pages: " + numberOfPages);
System.out.println("Paperback:" + isPaperback);
System.out.println("Suggested Price: $" + price);
}
Similar Messages
-
When I try to simply add a few photos (from Events) into a newly created Album, it always creates a new Folder - a sub folder to the new Album I just created - for the photos to go into. I don't need a Folder! I just need the photos to add into the Album. What am I doing wrong?
Sometimes it takes a precise drop to get it into the album. Make sure you see the album highlighted before releasing the mouse:
OT -
My ipod nano 6th gen. is connected to my MacBook. I have an audio book on the MacBook in Itunes, and cannot load it into the Ipod. What am I doing wrong?
Is this audiobook configured to sync to your iPod via it's Books configuration pane in iTunes? Click on your iPod's device name under Devices in the left hand pane of iTunes. This will bring you to the Summary tab. Look for the Books tab along the top and click on it.
B-rock -
I can't get into my iTunes. What am I doing wrong?
I can't get into iTunes. What am I doing wrong?
Close your iTunes,
Go to command Prompt -
(Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
(Win XP SP2 & above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
In the "Command Prompt" screen, type in
netsh winsock reset
Hit "ENTER" key
Restart your computer.
If you do get a prompt after restart windows to remap LSP, just click NO.
Now launch your iTunes and see if it is working now.
If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
http://support.apple.com/kb/TS4123?viewlocale=en_US -
I cannot load Nikon D810 NEF files into CC 20141. What am I doing wrong?
I just down loaded CC 2014. I am trying to work with NEF files from my Nikon D810. CC will not load these files. All updates are installed.
You should find the forum for whichever product this concerns and post your question(s) there.
Here is a link to a page that has links to all Adobe forums...
Forum links page: https://forums.adobe.com/welcome -
Im trying to convert a PDF into an excel document and I keep getting an error message that reads "An error has occurred while trying to access the service". WHat am I doing wrong?
it seems my subscription had expired so I signed up again.. It was still having trouble so I repeated the sign up process again.. Then it worked perfectly.. Unfortunately, I think I just subscribed twice and need to cancel one of them. Ugh. Such a pain when I'm trying to get this project completed. I'll be canceling at least one of the subscriptions in the morning. Adobe is not my favorite company right now. None of this was intuitive. And trying to get help was an absolute waste of an hour.
Regards,
Nathaniel
[removed by moderator] -
I make annotations to my photos in iphoto using preview. But once I have made the annotation I do not get the photo back into the event in iphoto from which I took the photo. What am I doing wrong? I am not using aperture
For the annotations to display on the photo in iPhoto you must setup Preview as the external editor in iPhoto via iPhoto's Advanced preference pane.
After adding the annotations just do a Save. iPhoto will then recognize the change via a new modified version. You can revert to the original at any time if you want to get rid of the text.
OT -
I put a calendar event into my iPhone (using iCloud calendar) but it does not show up in my Outlook iCloud calendar. Any idea what i am doing wrong?
Are you sure that you put the event on your iCloud calendar? You might want to check Settings>Mail,Contacts,Calendars>Default Calendar to be sure you have selected the calendar listed under your iCloud account as your default.
-
Trying to update iTunes on iPhone 4s. Went to site, selected download, says thank you. Plug phone into computer and pops up cannot be used phone requires 10.5 blah blah blah. What m I doing wrong?
i used to have no trouble downloading music on my iphone 4s from i tunes, but now it just says cant download try later. is this caused by not having the current update or something else?
-
When I connect my iPad with usb to my mac the iPad gives me a "blinking" message asking to trust the computer. Problem is it does not give me enough time to select yes. What am I doing wrong? Help!
Everything that you sync to the iPad is done through iTunes or from downloading from the cloud if they are iTunes purchases or through iTunes Match, if subscribed.
It is also not possible to transfer music or certain other files though Bluetooth between other iPhones or Android devices. You can transfer between iOS devices, pictures through devices that are Airdrop capable. -
I am trying to download a calendar into ical and keep getting this message-Some of the events in this calendar have alerts that open files or applications. Remove alerts or cancel
What am I doing wrong or missing??I have this same problem in October of 2013. I am unable to import .ics files into Lion that I exported from my Snow Leopard MacBookPro without losing all of my future events (which all have alerts attached). All of the events from BEFORE today's date are successfully importing, presumably because they are no longer expected to trigger alerts via Apple Mail. After my first unsuccessful attempt, I learned that iCal was communicating with iCloud by default. I have since turned off iCloud, but I have not found a solution to the problem. Harvey
-
I'm trying to make a ring to for iPhone and about 20 sec into the playing of the song it fades out and goes silent. What am I doing wrong? Thanks
Im not sure what garage band is, but i can tell you the way apple recommends making ringtones. Highlight a song in iTunes, right click and select get info. Goto the options tab and youll see the time lengths (write down the ending time) for the start time type in where you want the ringtone to start, ringtones can only be 30 sec long so make the ending time 30 sec later. Exit it out of the info and while song highlighted goto the "advanced" tab at the top of iTunes where you will see an option that says "create aac version". after creating the aac version you will have a duplicate song in your iTunes, change the original back to the correct time length. Take the 30 sec aac version and drag it to your desktop, right click the icon and click "preferences" You will then be able to change the name of the file which will be somethign to the effect of "songnamehere.m4a" you just change the m4a to m4r. you now have a ringtone, drag the new file to iTunes where it will pop up in a new tab labled ringtones. If you cannot change the name of the file when it is on your desktop let me know and i will give you instuctions how to be able to change it. Once you get it figured out you can use any song you have on iTunes to make a ringtone.
-
My email on my mac (which has iCloud) is giving me a message that the server has rejected my password. When I go onto the internet and sign into iCloud there, the password is accepted. What am I doing wrong??
Thanks...I just spent an hour on the phone with Apple Support sorting out the password issues for my various devices!!! My password was compliant with the new rules, but there were some (mysterious) setting issues that required me to delete mail from my MacBookPro and add it back, again. All in all, it was an hour of trouble-shooting which resulted in what, I hope, is a good fix.
Thanks for your help...wishing you continued success in the support community. -
I Just bought a used 6th gen nano and when I plug it into the usb it says on my itunes page "an ipod has been detected but cannot be identified properly". I have already registered it. What am I doing wrong? Is it a faulty one?
The following document might be worth a try with that:
iPod nano: Error message saying that iPod 'could not be identified properly' -
when i go to use my game center app i login and it tells me i have to creat a profile so i hit yes and then i bownce inbetween selecting country and selecting birth date what am i doing wrong???????????????
-Acedogwhat am i doing wrong???????????????
You were perhaps born in the wrong place on the wrong day!
Maybe you are looking for
-
Tomcat (newbie to Mac) how to install and run?
Hi, I wonder if anyone knows any good tutorial of how to install tomcat on MAC? Also, I'm not really sure what type of tomcat I should use for mac (Tomcat specifically and explicitly offer the window's package) any DIRECT url will be GREAT...I'm look
-
My iphone 4s is in recovery mode after updating and keeps getting error 4005
Hi there, I recently tried updating to iOS 7.1 using iTunes. Don't know what went wrong but I got an error (quickly clicked it away so don't know what the first error was) and it is now in recovery mode. Whenever I try to recover it with iTunes it st
-
WRT54G freezes when mac connects with airport card
I'm using WRT54G, i have plugged to it 3 things; cable modem, a PC desktop and a mac desktop. that all works great. When I connect via my mac laptop the router freezes, sometimes. i've been tracking it and there is no consistency of how long until it
-
What is "RoboHelp Word COM addin" for Microsoft Word?
HI, I can't find a solution anywhere! A few months ago, I was able to create a PDF using Acrobat Professional 8 >> Create PDF from file, and then I suddenly could not. On Adobe's site, I found that I needed to re-enable this particular addin, which w
-
Hi experts.... I want to debug an abap function called from a java webdynpro. I've set an external break-point for the user RFCUSER in the abap function. the function work fine but the flow doesn't stop at the break-point. anyone can help me?? Marco