Some programming help needed
I'm trying to make an alarm clock... I've done all the code but I don't know how to play sounds... I've seen that there is some sort of class for sounds with applets, but I didn't make an applet. It's just normal AWT... can anybody help me out? .....also, is there a more efficient way of 'updating' the clock-label? I used a while loop, but I don't think it's the way it's supposed to be done.
thanks
I am not sure what you mean by using a while loop to update the clock-label. I would have used a Timer class to change the time at the given intervals (say every second).
Similar Messages
-
Dollar Change Program Help needed!!
I need some immediate help writing a java program that determines change of 1 dollar recieved in the amout of quarters, dimes, and nickels when an item is purchased between the prices of 25cents and a dollar. For Example:
Total Money: $1 (static)
Enter the price of the item in cents: 45
You bought an item for 45 cent and gave me a dollar, so your change is:
2 quarters,
0 dimes, and
1 nickel.
That is the basics of what I need, and I am not sure where to start.My program works as long as there is at least 1 penny to be given back in the change. I need help!
// CoinCounter.java
// This program counts the change given back from 1 dollar
// in specific values such as quarters, dimes, and nickels
// and pennies.
// Written By Jasen Hudson
import javax.swing.*;
import cs1.Keyboard;
public class CoinCounter
{// Begin class CoinCounter
public static void main(String[] args)
{// Begin main method
int cost = 0;
int dollar = 100;
int quarter = 25;
int dime = 10;
int nickel = 5;
int penny = 1;
int numQuarters = 0;
int numDimes = 0;
int numNickels = 0;
int numPennies = 0;
//Item amount input
String input = JOptionPane.showInputDialog
("Please enter the amount paid for the item.");
cost = Integer.parseInt(input);
//While statement
int changeRequired = dollar - cost;
while(changeRequired > 0){
if((changeRequired - quarter>= 0){
numQuarters ++;
changeRequired -= quarter;
continue;
if(changeRequired - dime >= 0){
numDimes ++;
changeRequired -= dime;
continue;
if(changeRequired - nickel >= 0){
numNickels ++;
changeRequired -= nickel;
continue;
if(changeRequired - penny >= 0){
numPennies ++;
changeRequired -= penny;
//Amount of change needed to give back
int change = dollar - cost;
//System print out
System.out.println("The change required for $1.00 from an item costing "
+ cost + " Cents is " +change+ ". Here is your change:");
System.out.println(numQuarters+" Quarters");
System.out.println(numDimes+" Dimes");
System.out.println(numNickels+" Nickels");
System.out.println(numPennies+" Pennies");
System.exit(0);
} -
Some urgent help needed with MobileMe suddenly saying my password is wrong
Hi
First of all I want to say sorry if this is in the wrong forum, but I needed some urgent help and I couldn't find a forum other than this that might relate to this issue.
The issue that I am having is with my MobileMe Account. I was on my Mac, when when my MobileMe Account suddenly dropped its connection and told me that I had entered the wrong username or password (I know I hadn't) I tried to re-enter them but every time I try I just get a message that says I have entered the wrong username or password. I no longer have access to my Mail, I can not sing-in to MobileMe to access my online account and it wont let me change the password because it keeps saying that safari can not open the page.
I can not sign-in to my MobileMe folders on my Mac and it wont sync. I was signed in perfectly fine before this happened so I know its nothing to-do with my password or user name.
I am now locked out of MobileMe and need some help as to what might have went wrong
Can someone please give me some quick help as this is really worrying me as I am afraid my MobileMe account might of been hacked (that is the kind of behaviour that I am seeing - saying that my username and password are wrong, when they are not, and not letting me sign in to change them)
Huge thanksUghhh,
it seems my panic was for nothing. I just ran apple 24 hour support and they put it right for me it cost me but I'd rather be safe and pay then loose all the information I have on MobileMe. This has taught me a lesson anyway, I need to keep a backup of everything and not just rely on time machine -
Basic Java Program help needed urgently.
I have posted the instructions to my project assignment on here that is due tomorrow. I have spent an extremely large amount of time trying to get the basics of programming and am having some difficulty off of the bat. Someone who has more experience with this and could walk me through the steps is what I am hoping for. Any Help however will be greatly appreciated. I am putting in a lot of effort, but I am not getting the results I need. Thank you for the consideration of assisting me with my issues. If you have any questions please feel free to ask. I would love to open up a dialogue.
CIS 120
Mathematical Operators
Project-1
Max possible pts 100
Write a program “MathOperators” that reads two integers, displays user’s name, sum, product,
difference, quotients and modulus of the two numbers.
1. Create a header for your project as follows:
* Prgrammer: Your Name (1 pt) *
* Class: CIS 120 (1 pt) *
* Section: (1 pt) *
* Instructor: (1 pt) *
* Program Name: Mathematical Operators (1 pt) *
* Description: This java program will ask the user to enter two integers and *
display sum, product, difference, quotients and modulus of the two numbers
* (5 pts) *
2. Display a friendly message e.g. Good Morning!! (2 pts)
3. Explain your program to the user e.g. This java program can add, subtract, multiply,
divide and calculate remainder of any two integer numbers entered by you. Let’s get
started…. (5 pts)
4. Prompt the user- Please enter your first name, store the value entered by user in a
string variable name. Use input.next() instead of input.nextLine(). (8 pts)
5. Prompt the user- name, enter first integer number , store the value entered by user in
an integer variable num1.(5 pts)
6. Prompt the user- name, enter second integer number , store the value entered by user in
an integer variable num2.(5 pts)
7. Display the numbers entered by the user as: name has entered the numbers num1and
num2.(5 pts)
8. Calculate sum, product, difference, quotients and modulus of the two numbers. ( 30 pts)
9. Display sum, product, difference, quotients and modulus of the two numbers. ( 10 pts)
10. Terminate your program with a friendly message like- Thanks for using my program,
have a nice day!!(2 pts)Nice try. You have not demonstrated that you've at least TRIED to do something. No one is going to do your homework for you. Your "urgency" is yours alone.
-
A little assistance and some big help needed
I seem to be running into a problem migrating an MSAccess 2000 database to XE.
I open the omwb2000.mde, select the database and define the location for the schema and data export.
The DAO msi opens and I get error 1706. No Valid Source could be found for product DAO. the windows installer cannot continue.
If I cancel the DAO and if I add forms and reports from the .mde I get error #5 - XML Exporter. Invalid procedure or call argument (the database location) Database Schema Export did not complete successfully.
Any help is very appreciated.
My local environment is:
Win XP SP2
Office 03 SP2
Oracle XE
OMWB 10.1.0.4.0Hi,
Have you tried re-registering the DAO dao360.dll? If, for some reason, your MDAC install has gotten corrupt, you'll need to re-register. Try executing the following from the Start | Run command:
regsvr32 "c:\program files\common files\microsoft shared\dao\dao360.dll"
I would also recommend using the omwb2003.mde, and converting your MS Access 2000 database to 2003, seeing as you have MS Access 2003 installed on your machine. We recommend using the version of the Exporter Tool that corresponds with the version of MS Access installed on your machine.
I hope this helps.
Regards,
Hilary -
Adobe Lightroom 4 - Some Questions / Help Needed
Hi everyone.
After advice from several experts, I've just purchased Adobe Lightroom 4. I've already got Photoshop CS5, but I was looking for something proper to organise my photos, plus I found Lightroom easier to do the sort of editing I am wanting to do. Now, I only really use photoshop for things like colour pops, or really in-depth editing. Anyway, I'm loving Lightroom so far, but there is some stuff I'm not very sure of, so I'd appreciate some help
1. Organising
Firstly, I'm not really sure how to organise. At the moment, I've just got lots of folders with random events in My Pictures on W7, so I might have a folder called April 11, which contains photos from that month but that might have been a wedding or an easter holiday or both. So it doesn't really work. \
I understand in Lightroom what catalogs are. But I know enough to know that I don't want to group mine into those, its getting too complicated. What I don't know though is the difference between a collection and a folder. Basically, I'm wanting to reimport and reorganise all my photos, so I want to put them into "events" as such like you can do on iPhoto on a mac, so I would have "France Summer Holiday 11" for example, or "Mia's Wedding". I'm not really sure on the best way to do this ...?
2. Editing
I've played around quite a bit so far, and I really like what I've seen. On a lot of photos, I've made a lot of changes. But from what I can see, these changes are stored merely in Lightroom itself. For example, at the moment I'm importing photos from my external disk into Lightroom, which then saves them in C://My Pictures/Lightroom/Pictures . When I go look at these photos in windows explorer which I know I have edited, it doesn't show any of the changes or editing I've done on them. Now I realise this is me being stupid, but why doesn't it? Supposing I then want to email that photo to a friend that I have edited? How would I do that? I don't want to have to open lightroom and export every single photo I edit? There must be a simpler way?
Likewise for backing up, because all my files are in subfolders within C:// My pictures / Lightroom / Pictures, to back up I was simply going to set up windows to copy that latter folder onto my external HDD everytime I plugged it in. This would be pointless however if it isn't physically overwriting the original photo with my edited version?
3. Editing 2
Something else I like to do is make lots of different edits to the same photo. For example, at the moment I'm editing a photo of a pier at night. I spent ages adjusting colours and lighting and so on, and now it looks great. But I would also like to save a copy of that photo with the "old age photo" effect preset on. Is this possible? and how do I do it? Other than obviously importing a duplicate?
4. & 5. & 6 - Misc:
4. Simple question - how do I add tags, keywords or comments if I haven't done it on import?
5. My camera doesn't have built in GPS. Is it possible for me to manually geotag photos (in a batch, say for a Summer Holiday to NY), could I manually add a geotag for all these photos?
6. I also forgot to add copyright information on import for some, is it possible to do this after import and how?
7. I normally shoot in JPEG. I probably shoot shoot in RAW as everyone tells me to do so. Are there any significant advantages in terms of quality, and for editing with?
Thanks for any help given. I appreciate this is a lot of questions, but I could really use the advice.Hi William,
1. Organising
Firstly, I'm not really sure how to organise. At the moment, I've just got lots of folders with random events in My Pictures on W7, so I might have a folder called April 11, which contains photos from that month but that might have been a wedding or an easter holiday or both. So it doesn't really work. \
I understand in Lightroom what catalogs are. But I know enough to know that I don't want to group mine into those, its getting too complicated. What I don't know though is the difference between a collection and a folder. Basically, I'm wanting to reimport and reorganise all my photos, so I want to put them into "events" as such like you can do on iPhoto on a mac, so I would have "France Summer Holiday 11" for example, or "Mia's Wedding". I'm not really sure on the best way to do this ...?
I am not so sure if you understand *catalogs*.
You need a catalog, exactly 1 in my opinion. A catalog is a database. The Lightroom database, where records about your images are stored, including the pointers to your images, which are not inside a catalog! LR backups just does the backup of the catalog (i.e. a file ending .lrcat). You need to take care separately that your real images are backed up !
Inside your LR database the best way to organize is via collections - this will give you what you want with "France summer holiday 11" etc.
Folders are relatively unimportant, just storage buckets. They should be *handy portions*, I would prefer them with below 3000 images each, as there currently some bugs to those bigger ones.
Before you start with LR, you can organize your pictures in Mac Finder / WindowsExplorer.
Or you could do it with the help of LR, by copying your images over during import into the destination folders (and deleting today's folders afterwards after having verified that everything is fine).
A simple date-based structure will do, I'd recommend a root parent folder like "LR images", underneath one folder per year (\2010\, \2011\, \2012\...) and underneath them either
just one folder per month (LR can auto-create them for you)
or you create the folders in import dialog as e.g. "YYYY-MM-DD description of shoot", to have a mini-diary overview also in your OS.
Apart from that you create collections, either *dumb ones*, where you drag images into, or smart ones, where you specify criteria according to which they get auto-filled.
2. Editing
I've played around quite a bit so far, and I really like what I've seen. On a lot of photos, I've made a lot of changes. But from what I can see, these changes are stored merely in Lightroom itself. For example, at the moment I'm importing photos from my external disk into Lightroom, which then saves them in C://My Pictures/Lightroom/Pictures . When I go look at these photos in windows explorer which I know I have edited, it doesn't show any of the changes or editing I've done on them. Now I realise this is me being stupid, but why doesn't it? Supposing I then want to email that photo to a friend that I have edited? How would I do that? I don't want to have to open lightroom and export every single photo I edit? There must be a simpler way?
Likewise for backing up, because all my files are in subfolders within C:// My pictures / Lightroom / Pictures, to back up I was simply going to set up windows to copy that latter folder onto my external HDD everytime I plugged it in. This would be pointless however if it isn't physically overwriting the original photo with my edited version?
LR will never overwrite your original photos.
You can save most of the catalog content into the xmp-part of the original photo, which is either a sidecar-file (.xmp) or part of the file format, like for DNG, TIFF, PSD, JPG. To do so you select the image in LR and hit <ctrl> s. Or you set it up for continuous update, which creates a lot of operations while you play back and forth in develop.
I do that on my own, typically twice per file: once I am done with develop, once I am done with keywording and other metadata update.
LR contains records about your images, i.e. a set of instructions how they are to be interpreted. That is all.
So of course you need LR to export the result of these instructions, which is actually pretty quick.
To backup your images you need to do that just once, plus you backup your LR catalog. Or if you save xmp to the files, you can do another backup once xmp is ready.
I would not consider this pointless. You just have to think that there are 2 places with data for your images: the images themselves and a database with interpretation instructions.
3. Editing 2
Something else I like to do is make lots of different edits to the same photo. For example, at the moment I'm editing a photo of a pier at night. I spent ages adjusting colours and lighting and so on, and now it looks great. But I would also like to save a copy of that photo with the "old age photo" effect preset on. Is this possible? and how do I do it? Other than obviously importing a duplicate?
Yes, this is one of LR's beauties: you create a so-called *virtual copy*, which is just a 2nd record for the same original image file with different interpretation settings, like black-and-white, a different crop size, different development etc. You can have as many virtual copies as you like, and you'll see them as additional thumbnails.
Virtual copies are not saveable into xmp, though. There is another concept which is saveable into xmp: snapshots. but these are different states in develop history, and you do not see outside develop module that you have several.
If you export virtual copies e.g. to jpg one file per virutal copy will be created.
4. & 5. & 6 - Misc:
4. Simple question - how do I add tags, keywords or comments if I haven't done it on import?
5. My camera doesn't have built in GPS. Is it possible for me to manually geotag photos (in a batch, say for a Summer Holiday to NY), could I manually add a geotag for all these photos?
6. I also forgot to add copyright information on import for some, is it possible to do this after import and how?
7. I normally shoot in JPEG. I probably shoot shoot in RAW as everyone tells me to do so. Are there any significant advantages in terms of quality, and for editing with?
Thanks for any help given. I appreciate this is a lot of questions, but I could really use the advice.
ad 4: you use the library module, metadata panel to enter.
ad 5: you use the map module. Either you manually drop your images on a map, or you have a separate GPS track to load and have LR assign via matching time-stamps.
ad 6: like 4
ad 7: You don't need JPG from your camera, you can achieve better results viy LR from RAW. Yes, there are significant advantages as to editing headroom.
Overall, may I suggest my favorite learning material for LR? First watch Julieanne's Tutorial Videos.
Then go play and use Victoria Bampton's eBook or paper copy of her "Missing FAQs to LR4": http://www.lightroomqueen.com/books/adobe-lightroom-4-missing-faq/
Have fun,
Cornelia -
Hi all. First up, thanks for reading. The problem:
Im currently doing a project to reflect the the difficulties involved in a large communications network (IE a mobile phone one)
For the UI, I have a canvas class to reflect the world that the agents (users) and Base Stations (Nodes) are in. The agents and Nodes both have seperate classes Essentially, each base station needs to pick up any agents with in a certain distance (radar)
Just wondering what would the easiest way for the nodes to pick up the agents on the canvas?
Here is a screen shot (you'll have to expand it to get the best resoulution
http://www.cs.ucc.ie/~ood1/project.bmp
if People need to see the code, just ask, and i'll put it up.
Thanks in advanceso basically your saying that have each tower
get the distance to each agent and then ifs
its in the radius of that tower, pick it up?
would this be considered cheating? Consider the real
world (which I have to accuratly reflect....:( ) If
you have a mobile 10 miles away from a Tower who has
a radius of 5 miles, it wont pick you up, its not
even aware of you.
m thinking that I'll have to use some setBounds on
the towers, and iterate through each xy position in
the bounds and if another component is found, it is
in range....
ah hell, im just gonna cheat..Thanks guys
Message was edited by: User
ChopsCheating? this sin't cheating at all. it's a program, not the real world. It would be "cheating" if you didn't do this. -
CSS11506 - Some basic help needed
Alright, I have a CSS11506 in the lab and I am trying to configure it into a reverse proxy config. So I would like to have all inbound http requests hit the CSS and then have it redirect to our web server on correct DMZ. Having never setup a CSS before I need some help.
- Is my service type proxy-cache, type redirect or type transparent cache ?
I know this should be fairly easy to do with the 11506. Can you also provide some docs explaining the config walkthru.
Any help would be appreciated.
Cheers
DaveThanks, that explains a few things.
So assuming the following, DMZ web server ip is 192.168.20.50 and VIP for CSS is 192.168.20.100, basically I would want to redirect all inbound http requests from 192.168.20.100 to the 192.168.20.50 using the following CSS config ?
service rprox1
ip address 192.168.20.50
protocol tcp
port 8080
active
owner clee
content redirect_rule
add service rprox1
vip address 192.168.20.100
protocol tcp
port 8080
url "/*"
Like I said, never configured one yet so this is my first attemtp.
Thanks again for the help
Cheers
Dave -
Hi,
I'm back again.
This time I need help with just one part of the code for my program.
right now in part of my code I have it ask for a name, but now I want to put in an if statement and see if soemone writes a number instead of a letter. I can't find that code anywhere, so can anyone help with this?
Thanks.Even though I'm 11 I am trying to obtain madcore Java skillz.
I don't understand what you said in that program. I have this:
class majorAssignment {
public static void main (String[] args) {
//Introduction to Pinkerton
System.out.println("Welcome to the Christopher Walken paycheck calculator, aka: 'The Walken Experience'.");
System.out.println("Please make sure that what you input into The Walken Experience is exactly what he asks for... Or else you'll find a pile of your own organs knocking at your door.");
System.out.println("The Walken Experience: Hello, \n Now scootch over and tell me your first name. Please. Do not make me tell you again. About the scootching.");
//Lets be greedy and grab someone's personal information
String familyName = In.getString();
if (familyName
//run
else
//runHow can I fit it in like that? -
SOCKET PROGRAMMING HELP NEEDED!!!!
hi,
I got an idea of establishing socket connection with all clients from SERVER through the windows command
called (arp -a). when we type the stated command on dosprompt in server, it gives the list of current system's
ipaddress.....switched on. SO i can establish socket connections in a for loop where i can take the following ipaddress from output listed from command.
i've written the code to call the command in JAVA.
i write the dosprompt output in a file named list1.txt
import java.util.*;
import java.io.*;
import java.io.File;
public class RunCommand
public static String[] runCommand(String cmd) throws IOException
ArrayList list = new ArrayList();
Process proc = Runtime.getRuntime().exec(cmd);
InputStream istr = proc.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(istr));
String str;
while ((str = br.readLine()) != null)
list.add(str);
try
proc.waitFor();
}catch (InterruptedException e)
System.err.println("process was interrupted");
// check its exit value
if (proc.exitValue() != 0)
System.err.println("exit value was non-zero");
// close stream
br.close();
// return list of strings to caller
return (String[])list.toArray(new String[0]);
public static void main(String[] args) throws Exception
try
FileWriter f1=new FileWriter("list1.txt");
String[] s = runCommand("arp -a");
for (int i = 0; i< s.length; i++)
f1.write(s);
System.out.println(s[i]);
f1.close();
}catch (Exception ex) { System.out.println(ex);}
SAMPLE OUTPUT:
Interface: 172.16.3.1 on Interface 0x1000003
Internet Address Physical Address Type
172.16.3.4 00-00-e2-13-a9-e8 dynamic
172.16.3.6 00-00-e2-13-aa-0f dynamic
172.16.3.10 00-00-e2-13-ab-bb dynamic
172.16.3.12 00-00-e2-13-ab-93 dynamic
172.16.3.16 00-00-e2-13-37-b8 dynamic
172.16.3.17 00-00-e2-13-37-19 dynamic
172.16.3.18 00-00-e2-13-37-1d dynamic
172.16.3.19 00-00-e2-13-38-98 dynamic
172.16.3.22 00-00-e2-13-37-54 dynamic
172.16.3.23 00-00-e2-13-39-02 dynamic
172.16.3.24 00-00-e2-13-39-0f dynamic
172.16.3.26 00-00-e2-13-37-a5 dynamic
172.16.3.27 00-00-e2-13-37-0b dynamic
172.16.3.28 00-00-e2-13-37-12 dynamic
172.16.3.29 00-00-e2-13-39-15 dynamic
172.16.3.30 00-00-e2-13-38-af dynamic
172.16.3.31 00-00-e2-13-37-fe dynamic
172.16.3.32 00-00-e2-13-38-ff dynamic
172.16.3.34 00-00-e2-13-ab-c8 dynamic
172.16.3.37 00-00-e2-13-ab-67 dynamic
172.16.3.42 00-00-e2-13-ab-19 dynamic
PLS HELP ME OUT IN GETTING ONLY THE IPADDRESS IN FOR LOOP IN SERVER SOCKET PROGRAM TO INVOKE ALL CLIENT'S PROGRAM IN NETWORK.
PLS HELP ME!!!!!!!
ATTACH THE CODE!!!!!!!!!!!!Connecting to a client presumes that the client is waiting for a connection.
If that is the case I would suggest looking a java.net.Socket. -
Some quick help needed with certificates and split brain dns.
I run exch 2010 and have one cas server(srv03). I have split brain dns configured and working in my system. I got a new certificate this year because of the new regulations that won't allow .internal names in the san portion of an ssl cert.
I have followed several tids on the internet and still when I tried to implement it today the outlook clients started getting a popup that says [the name on the certificate is invalid or does not match the name of the site] At the top of this popup
is srv03.abccorp.internal which is what it was before.
The certificate is for mail.abccorp.com and also includes autodiscover.abccorp.com and srv03.abccorp.com.
When I run [Get-clientAccessServer | fl Name,AutoDiscoverServiceInternalUri] the name and the Url is correct and has the .com value.
When I run the test email autoconfiguration from my Outlook icon, and look at the log, Autodiscover URL found through SCP, is correct and it says Succeeded at the end. In the results tab however the Server, Availability Service, OOF URL are still showing
the .internal instead of .com. The Internal OWA, External OWA and the OAB are correctly displaying the .com. What commands do I need to run to change these as they seem to be the problem.
I wasted a lot of time chasing the autodiscover before I found out about this test in outlook and realized the autodiscover url was correct. :-)
I have two days left on my old cert that has both .com and .internal SANs so I rolled that back into service so the users stop getting messages. Any help would be appreciated.Hi OTS,
You can run the following command to Change the InternalUrl attribute of the EWS:
Set-WebServicesVirtualDirectory -Identity "CAS_Server_Name\EWS (Default Web Site)" -InternalUrl https://mail.abccorp.com/ews/exchange.asmx
Best regards,
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
Niko Cheng
TechNet Community Support -
I am trying to install a software program on my destop computer, I am the administrator, running 7 Home Premium, 64 bit, I downloaded the program but when I try to install "Installer failed to initialize". I turned off the antivirus program, that did not help. I contacted Adobe for help, I did what they said, turn off antivirus, redownload,tried to install and again "Installer failed to initialize". Any ideas as to what I can do?
When requesting help you should always include the make/model (i.e. p6-xxxx) of the computer and/or monitor. This information is necessary for us to review the specifications of them.
What is the program? I presume that it is an Adobe product.
Signature:
HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
HP Photosmart 7520 AIO
++++++++++++++++++
**Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
Intelligence is God given; Wisdom is the sum of our mistakes!
I am not an HP employee. -
Programing help needed urgently
Please help with my home work I'm really stuck
Read in an integer from the keyboard, then check to see whether it is :
Positive or not
Even or odd
A multiple of 7 or not
The number must be displayed together with each of the tests.
I don't know how to check for a multiple of seven that were I had a problem.
Here is the program that I have written so far. It is in java.
import java.util.Scanner;
public class hwork11
public static void main (String[]args)
Scanner input=new Scanner (System.in);
System.out.println("please enter a number");
int num=input.nextInt(System.in);
if(num>0)
System.out.println(num+" is negative"):
else
System.out.println(num+" is positive");
if( num%2 == 0)
System.out.println(num+" even number");
else
System.out.println(num+" odd number");
}Vee190 wrote:Please help with my home work I'm really stuck
Read in an integer from the keyboard, then check to see whether it is :
Positive or not
Even or odd
A multiple of 7 or not
The number must be displayed together with each of the tests.
I don't know how to check for a multiple of seven that were I had a problem.
Here is the program that I have written so far. *{color:#0000ff}({color}* It is in java. *{color:#0000ff}r u kiddin me )*
*{color}*
import java.util.Scanner;
public class hwork11
public static void main (String[]args)
Scanner input=new Scanner (System.in);
System.out.println("please enter a number");
int num=input.nextInt(System.in);
if(num>0) *{color:#0000ff}( I think that numbers >0 are +. Whuddya think?){color}*
System.out.println(num+" is negative"):
else
System.out.println(num+" is positive");
if( num%2 == 0) *{color:#0000ff}If num is 4, do know why this statement is true? (num % 2 == 0)*
**The key to answering your question about whether or not a number is a multiple of 7 is understanding the use of the % operator. Look it up, and figure it out. You will learn programming languages much faster if you understand what it is you are typing, rather than just trying to make a program by copying lines of code out of the book.*{color}*
System.out.println(num+" even number");
else
System.out.println(num+" odd number"); -
1. class A555{
2. public static void main(String []args){
3. Boolean b1 = new Boolean(true);
4. Boolean b2 = new Boolean(true);
5. System.out.println( false +" " );
6. }
7. }
Regarding the above question, at line 5 if i use a boolean literal the program doesn't give any error but whenever i am using b1==b2 *(the two Boolean objects declared,initialized at 3 and 4)* in place of boolean literal, i am getting a compiler compiler error: incomparable types: java.lang.Boolean and java.lang.String . Kindly tell me what could be the reason?If you do:
System.out.println(b1==b2 + " ");
The compiler will try to make: b1 == (b2 + " ")
so he is trying to add a string " " to the b2
if you make: System.out.println((b1==b2) + " "); that should work
this is a problem of precedence with the operators
Hope this help!
Alex -
Hello,
I have a CLOB that needs to be scanned for a certain string. I was just putting the CLOB as a parameter to the instr function but some of the CLOBs are too large for the string buffer. The error I get is:
"ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 9422, maximum: 4000)"
Does anyone know an efficient workaround for this?
Thanks!I was just putting the CLOB as a parameter to the instr function
dbms_lob.instr is your friend ;-)
Maybe you are looking for
-
My battery barely lasts for 3 hours...
My battery barely lasts for 3 hours and won't charge while in use & the phone heats a lot. The phone is only about 6 months old, will the battery be replaced under the apple warrenty?
-
How to clear the fields within copy routines in the copy contorl
HI Gurus, I need to clear the fields VBP-VBELV and VBAP-PSSNV within the copy routines 303 in the copy control between quote item and sales order item. I am not sure how to do that... Can some body please help. This is required because we had sales
-
Editor Kit Mystery behavior. I don't get how this works.
I build a JTextPane which is editable, save it to a file, and load it back after which it's editing behavior is completely whacked out. The text region is originally built like this: textRegion = new JTextPane(); StyledDocument doc =
-
Third Party Software vs. RSC
My company is in the process of researching and selecting software for version control. I think they are considering PVCS or Rational ClearCase. This software would be used for software development and possibly for RoboHelp also. Does anyone know how
-
ICal Feature, Bug, or Configuration Problem?
We have a school calendar running on iCal Server (10.6.4) called "CS Calendars". Each user has one default calendar when the account is created on the local MacBook (10.6.4). Many users have created additional calendars under "CS Calendars" so that t