Hello, I am stuck as to what to do from here in this hopefully simple prog
I am trying to write a program that the user can enter any number in any unit of these (seconds, minutes, hours, centihours, or years). Then it should ask what to convert it into then the user could choose to convert it to seconds, minutes,hours, centihours, or years.
Any ideas?
This is what I have so far but I am stuck as to what to do from here:
import javax.swing.JOptionPane;
public class converttime{
public static void main (String[] args){
double inputNum = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter a number: "));
Sring unit = JOptionPane.showInputDialog(null,"What unit is the number entered in? ");
String convert = JOptionPane.showInputDialog(null, "Do you want this converted into seconds, minutes, hours, centihours, or years?");
}
The least complicated way IMO is to write a series of if/elses. Something like this (pseudocode):
if (unit is seconds) {
if (convert is minutes) {
apply second-minutes conversion factor
else if (convert is hours) {
apply second-hours conversion factor
etc...
else if (unit is minutes) {
if (convert is seconds) {
apply minutes-seconds conversion factor
else if (convert is hours) {
apply minutes-hours conversion factor
etc...
etc...You should define the conversion factors as constants, and use the String.equals(String) method to compare Strings.
There are more clever ways to do it, but if you're a beginner, this may be easiest.
Similar Messages
-
Power whent down whils my Apple TV was updating. I get no signal and its blinking rapidly. Anyone know what to do from here?
Due to the power outage the update was unable to be applied properly. You will need to grab a micro usb cable and restore via iTunes.
Apple TV (2nd and 3rd generation): Restoring your Apple TV - Apple Support -
I cannot download recently purchased album on iphone to itunes on computer. says to make sure connection to network is active and try again. don't know what to do from here!!!
Did you find a resolution as I'm having same problem?
-
I had a code to get logics pro for free and after it installed its asking me for a serial number but it never gave me one to put in, it just started downloading and then asked me. Does anyone know what to do from here.
I really don't think that is anywhere near on track.
Most likely the trial version was installed earlier, is that correct? -
I'm unable to download Maverick. I'm told to sign under the account I used to purchase it. I am signed in under my Apple ID. I'm signed in with iTunes. I don't know what else to do. Has anyone else had this problem?
Thanks for trying, but I've done that. It matters not, I keep getting the same message about signing in with same account used to purchase it. I've had the same account since I bought the iMac. So, I'm stymied.
-
my daughters ipod currently reads"ipod is disabled, connect to itunes". i am currently connected to itunes, but im clueless as to what i need to do to get the ipod back to the normal screen that displays the main screen to be able to use the ipod properly. i have tried resetting the ipod by turning the system off and back on already, can anyone help me?!!
thanks
blonde mom in tennesseePlace the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: How to back up
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
for sometime i have been using the emoticons seamlessly between my iphone and imac through imessage but now it seems to be kaput. it will send from my phone to the imac but from the imac to the phone is converting to symbols. what am i doing wrong?
Thank-you for the response RJTUK. I thought I was losing my mind. I thought that I would add for those that are following this post. I also noticed that the emoticons are showing up fine from iMac to MacBook. It seems the only loss in info is with the my iPhone [iphone 5 os 6.1]. So it definitely must be on the phones end? Hoping that someone will fix this shortly. I know it is silly but I really enjoy the personality that emoticons can add to a imessage.
-
My iphone was restored and i tried to back it up, but instead of getting all of my information i got my mother's instead. I dont know if i should try to reset my phone again because im worried that my mother will lose all of her data too??
Reset the device:
Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
If that doesn't help, tap Settings > General > Reset > Reset All Settings
If nothiing above helped, restore the iPhone to factory settings > Use iTunes to restore your iOS device to factory settings -
i started the update on my iphone 4 and the creen went to an apple symbol with a progress bar , then to a black screen with the apple symbol and thren to a picture of a USB with arrow to itunes. how do i fix this ,end this ??????? unable to use phone
Connect your phone to itunes and restore it by clicking the restore button, then restore from backup.
-
help with my questions above
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: How to back up
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
If you previous synced to the computer then you may be able to recovery use of the iPod without erasing the iPod by following the instructions here:
Disabled Recovery-must use syncing computer. -
Unrecoverable hard drive - have replacement. What to do from here?
Thanks in advance for your time. A couple of weeks ago, I updated the software on my wife's early 2011 macbook pro 13". During the reboot, it froze on the loading screen, and on other advice in this forum, I used Disk Utility to verify the drive. Well, it came back unrecoverable, so I purchased a shiny new SSD to replace it. I have at my disposal:
My wife's MacBook
A new SSD
Her files backed up to CrashPlan online
A windows PC to facilitate any recovery or data moving that may need to happen
An external hard drive dock that I should be able to use with the PC or Mac
At the time of the crash, the MacBook was running OSX Mountain Lion, but I'm unsure if I have a disk to reinstall it on the new drive.
Here are my questions:
Will I need special tools to remove the current drive?
Assuming the drive isn't too shot, should I theoretically be able to pull the files under her user folder off the old drive using the dock and my windows PC?
Can I locate an installer for Mountain Lion online somewhere? I can figure out how to make a bootable image if I have an ISO.
If not, is my best bet to install Yosemite and do the CrashPlan restore from there? I'm not sure if her programs will be restorable - really just worried about pics, docs and music.
Any other advice or gotchas would be appreciated.
Thanks!
Will.You will need special Torx drivers to remove the bottom plate screws and the interior disk mounting screws.
If the drive isn't "too shot" then you may only need to re-partition and format it rather than replace it. To transfer data from it will require that you put it in an enclosure or docking adaptor in order to access it. You can't use your PC. This can be done after replacing and prepping the new drive.
No. You will need to follow the procedure outlined below. After which you can download Yosemite from the App Store.
Clean Install of Snow Leopard
Be sure to make a backup first because the following procedure will erase
the drive and everything on it.
1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
with your computer. Insert the disc into the optical drive and restart the computer.
After the chime press and hold down the "C" key. Release the key when you see
a small spinning gear appear below the dark gray Apple logo.
2. After the installer loads select your language and click on the Continue
button. When the menu bar appears select Disk Utility from the Utilities menu.
After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
size.) Click on the Partition tab in the DU main window. Set the number of
partitions to one (1) from the Partitions drop down menu, click on Options button
and select GUID, click on OK, then set the format type to MacOS Extended
(Journaled, if supported), then click on the Apply button.
3. When the formatting has completed quit DU and return to the installer. Proceed
with the OS X installation and follow the directions included with the installer.
4. When the installation has completed your computer will Restart into the Setup
Assistant. Be sure you configure your initial admin account with the exact same
username and password that you used on your old drive. After you finish Setup
Assistant will complete the installation after which you will be running a fresh
install of OS X. You can now begin the update process by opening Software
Update and installing all recommended updates to bring your installation current.
Download and install Mac OS X 10.6.8 Update Combo v1.1. -
How to use Smart cut and what are the restrictions to use this
Hello,
How to use Smartcut and what are the restrictions to use this.
is it possible in version 9.
and is it safer to use it in real iproject mplementation?
Thanks in advanceHi
read more about smartcuts here http://download.oracle.com/docs/cd/E12825_01/epm.111/bpmui_admin.pdf
read "Managing smartcuts"
Regards
alexander -
We have three computers (two pcs and one mac) on our home sharing network. When I buy a song on my pc it is automatically downloading it to my husband's pc - but not my daugher's mac. The settings on each library do not indicate any items should automatically download. What am I missing here? This is a relatively recent thing I just noticed. It was not always happening in this way. Help. Both pcs are on Windows 7. Thanks in advance for any help. My husband and I don't always like the same songs so I need help to get back to marital bliss....
I think I found the answer to my own problemin case anyone experienced the same thing. There is a separate spot in itunes under preferences to allow for automatic downloads from other devices. It seems unrelated to home sharing. I unchecked the boxes under the "store" section and that appears to have taken care of the issue.
-
Hello to everyone!I think that I have installed a virus to my mac because safari opens advertising sites all the time and Facebook stucks a lot.What i should do to make my mac as it was before?
From the Safari menu bar, select
Safari ▹ Preferences... ▹ Extensions
Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit. -
Hello All, I have recently made the switch to all things Apple and still feel quite the rookie so hoping I can find help here! I'm a bit in shock as 0f now because my entire music libra was deleted by accident and I am completely stuck as to what to do now..I just got the 4s and haven't transferred much music over at all..I figured i could just export it all back but to my Mac...Any advice guys , is it even possible?
Restore from TimeMachine back-up.
Maybe you are looking for
-
Exporting a PDF Ledger sheet to Excel
When I try to export a PDF of a ledger with multiple columns to excel it makes it all one column with each line of the ledger then being a single cell which I can no longer format. It is impossible to use as an excel spreadsheet.
-
Apache (httpd) restarts automatically
After booting my mac my webserver is not running. starting apache with the command "sudo apachectl -k start" works as it should. the webserver has been started. but after the command "sudo apachectl -k stop" the following happens: (logfile) [Fri Aug
-
Deficit of unrestricted stock while trying to do 313 inspite of having stck
Dear Guruz, This is a weird situation where i am having 1000 quantities of material x in str loc. Note: none is in blocked /quality inspection. 1000 quantities in unrestricted use. Now when i am trying to do remove(650 quantities) from storage using
-
Hi- I'm stressing with AS3, I found an awesome tutorial to create a blur button but I can't figure out how to make it go to and play consistantly. Can anyone help? Here is the link. A sample code would be ideal. Thanks in advance. http://flashexplain
-
How wide to make a website in pixels?
Haven't made a website in a WHILE, and I realize the game has changed. How many pixels wide are people designing at these days, as a rule of thumb?