Directions...Write a program SumOfOdds that has one main method that asks the user to input two odd integers where the first is smaller than the second. The program ouputs the sum of all the odd integers from the smaller output to the larger output. You must use a while loop for this program.:)

import javax.swing.JOptionPane;
public class SumOfOdds {

    public static void main (String[] args)
	{
		String number = JOptionPane.showInputDialog("Enter Number 1: ");
		double number = Double.parseDouble(input);
		String number = JOptionPane.showInputDialog("Enter a number that is greater than Number 1: ");
		double number = Double.parseDouble(input);
		SumOfOdds sum = new Sum(number);
    	while (num1<num2)
			if (num1%2==1)&&(num2%2==1)
    		{

    		}
		System.exit(0);
    }
}
Comments
You do not specify what you need done.

I guess your question is how to make it work?

Well, here is a few problem with your code:

blablabla...

Edited 5 Years Ago by leodash: Previous reply gave too much help

I guess your question is how to make it work?

You shouldn't have to "guess". What I am getting at is he should be posting a full "problem" description, not just describing what is supposed to happen and then a blurb of code that may, or may not, have been written by the OP, and then expect everyone to "finish" the code for them without even any hint as to what is still missing, or wrong.

You shouldn't have to "guess". What I am getting at is he should be posting a full "problem" description, not just describing what is supposed to happen and then a blurb of code that may, or may not, have been written by the OP, and then expect everyone to "finish" the code for them without even any hint as to what is still missing, or wrong.

I guess you were right after all(sorry for guessing again lol). I agree finishing the program for him does not make him learn anything.

@TigerTeck: You should start learning the basic of programming. My advice is when you learn one thing, start practise with it. Do not proceed if you still didn't get the previous lesson. Honestly, I learned a lot from Youtube since my lecturer sucks. You should check it out there too if you have some time.

This article has been dead for over six months. Start a new discussion instead.