A community for students.
Here's the question you clicked on:
 0 viewing
Jaweria
 3 years ago
Anyone can help me with Java programming problems?
Jaweria
 3 years ago
Anyone can help me with Java programming problems?

This Question is Closed

eSpeX
 3 years ago
Best ResponseYou've already chosen the best response.0You would be better served if you were to simply ask the question you need assistance with.

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.0I do have couple of questions on java I tried to solve them but still giving me an error

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.0as you can see this question: Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces. I tried everything for this question and now I deleted all my wrong answers!! because I was angry.

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.0int i; for (i=0;i<200; i++) { if(i%2==0 i%3==0) { System.out.println [i]; } } This is what I had for an answer but still getting error

Opcode
 3 years ago
Best ResponseYou've already chosen the best response.0Try: ``` public class Main{ public static void main(String[] args) { for (int i = 1; i < 200; i++) { if ((i % 2) == 0 && (i % 3) == 0) { System.out.println(i); } } } } ```

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0What Opcode is saying is that you're missing a few elements: The main function (which tells the JVM what to do) The && operator (logical and, returns true iff both booleans are true) between i % 2 == 0 and i % 3 == 0 (because supposedly you want the number to be divisible by 2 and 3) Replace [] with () when declaring function arguments. VALID: System.out.println("") INVALID: System.out.println[]

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0daniel wats the difference between & and && in java

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0The problem is actually a grouping problem. The statement: if ((i %2) == 0 && (i % 3) == 0) needs additional parenthesis to group the checks together. if ( ( (i%2) == 0) && ( (i%3) == 0)) This will make the program work.

rsmith6559
 3 years ago
Best ResponseYou've already chosen the best response.0A single ampersand is a bitwise and. A double ampersand ands boolean values.

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.0Anyone please help me get started with this problem in java its due tonight.

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.0Make a Java program that prints 3 lines and then uses one Turtle in one World to draw two digits or letters near the center. Learn to quickly write, save, test and improve programs outside of lab, and upload course work to Blackboard for credit, so this is not a problem.

jaweria
 3 years ago
Best ResponseYou've already chosen the best response.01. Code in the main method three calls to method System.out.println( ... ) print on 3 separate lines your full name, your UAlbany NetId and the "iClicker ID" from the back of your iClicker The code that prints the ID of one of my iClickers is System.out.println( "348F05BE" ); 2. Under the lines that commanded the printing, code additional lines to make a World, and then make a Turtle in that World. Here's how: World wRef = new World( ); Turtle tRef = new Turtle( w ); The two assignments coded by the two = symbols cause two variables wRef and tRef to hold, as their values, references to two new objects. wRef is NOT a World; tRef is NOT a Turtle. wRef is the name of a reference variable; it's ok to say, for short, wRef is a variable. Similarly, tRef is the variable your program will use to refer to a Turtle for the purpose of telling it (or he or she) to move forward, turn and put its (his or her) pen up or down. These points will be stressed soon but not right away. For now, just base your work on my example. 3. Finish the program to make the Turtle draw, the first above the second, near the middle of Project 1 Introduction to Computer Science ICSI201 Spring 2013the window, the any two different digits or letters of your iClicker ID UNLESS THEY ARE B or E. If you have a B or an E or both, replace them with other digits or letters from your iClicker ID. The only Turtle methods you are allowed to use now are tRef.forward( integer distance ) tRef.turn( double amount of rotation ) tRef.penUp( ) tRef.penDown( ) and, optionally, setPenColor(... ) and/or setPenWidth( ... ). The moveTo( ... ) and other methods are ok in FUTURE ASSIGNENTS, but NOT Project 1, because moveTo makes the problem solving practice you get too easy! Important: How to figure out solutions to problems like this: 1. Study my sample code and its results: Trace using a pencil what the Turtle does (it mostly moves in a straight line or turns in place a given number of degrees) in order to draw the B and the E. 2. Write original code to draw your two digits or letters. 3. Finish, test, perfect and enjoy the first digit or letter BEFORE trying to work on the second. 4. Figure out, code, test, and IMPROVE your artistic results JUST A LITTLE AT A TIME, running the program and seeing the results again and again. It is OK to use trial, error and correction, which is what I did.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.