I am finishing up writing an extensive C/C++ program and am in dire need of completing these 4 short JAVA programs. Any help would be appreciated GREATLY! (I missed a few days of lecture and am extremely behind in this class.. :sad:
EDIT:
actually just helping me with one or two of these would be GREAT.. :o


1) Write a program that displays the recommended weight, given the user's age and height. The formula for calculating the recommended weight is:

recommendedWeight = (height - 100 + age % 10) * 0.90

Define a service class named Height and include an appropriate method for getting a recommended weight of a designated height.
-------------------------------------------------------------------
2) Write and application to convert centimeters(input) to feet and inches(output). Use JOptionPane for input and output. 1 inch = 2.54 centimeters
-------------------------------------------------------------------
3)Write an application that inputs temperature in degrees Celsius and prints out the temperature in degrees Farenheit. Use System.in for input and system.out for output. The formula to convert degrees Celsius to the equibalent degrees Fahrenheit is:

Fahrenheit = 1.8 x Celsius + 32
------------------------------------------------------------------
4) Write an application that determines the number of days in a given semester. Input to the program is the year, month, and day information of the first and last days of a semester. HINT: create GregorianCalendar objects for the start and end dates of a semester and manipulate their DAY_OF_YEAR data.

Im going to copy and paste what code I have in a sec. hold up :cool:

ok, this is what I have thus far. Dont get me wrong, Im pretty sure none of these work 100% like they should (my compiler here at home isnt working correctly, so I have to wait till i get to school tomorrow to check what I have done). ALSO, to let you know.. This is my third week of Java, so I am a newb, please dont be too hard on me!

ok, this one corresponds to question # 2 above:

/*
	Chapter 3 Program: Convert Centimeters to feet and inches
			   given Centimeters
	File: ch3problem8.java
*/

import javax.swing.*;
import java.text.*;


class  ch3problem8  {

	public static void main( String[] args )  {
	
		final double inches = 2.54
		
		String calc;
		double Centimeters, feet, inches;
		
		//Get Input
		calc = JOptionPane.showInputDialog (null," Enter Centimeters:");
		Centimeters = Double.parseDouble(calc)
		
		
		//computations
		inches = 2.54       ;
		feet = 2.54 * 12  ;
		
		//Display the results
		System.out.println("");
		System.out.println("Given Centimeters: " + Centimeters);
		System.out.println("inches: " + inches);
		System.out.println("feet: " + feet);
		}
	}

and this one corresponds to question #3 above:

/*
	Chapter 3 Program: Converts the temperature in degrees Celsius(input)
			   to temperature in degrees Fahrenheit(output)
			   
	File: ch3problem9
*/

import java.io.*;

class ch3problem9 {

	public static void main( String[] args ) throws IOException {
	
	String CelStr;
	double Celsius, Fahrenheit;
	BufferedReader bufReader;
	
	bufReader = new BufferedReader(
		    new InputStreamReader( System.in ) );
	//get input
	System.out.print("Enter temperature in degrees Celsius: ");
	CelStr = bufReader.readLine();
	
	Celsius = Double.parseDouble(CelStr);
	
	//compute
	Fahrenheit = 1.8 * Celsius + 32;
	
	//Display the results
	System.out.println("");
	System.out.println("Given Celsius: " + Celsius);
	System.out.println("Fahrenheit: " + Fahrenheit);
             }
}

finally, this corresponds to #4: (and I think its waaay off, but it works)

/*
Chapter 3 Sample Program: calculates the # of days in a given semester

File: Chapter3number15.java

*/

import java.util.*;
import java.text.*;
import java.io.*;

class Chapter3number15	{

public static void main( String[] args ) throws IOException {

	String InputStr;
	int	year, month, day;

	GregorianCalendar cal;
	SimpleDateFormat  sdf;

	BufferedReader bufReader;

	bufReader = new BufferedReader(
	    new InputStreamReader( system.in ) );
	    
	System.out.print("Year (yyyy): ");

	inputStr = bufReader.readLine();
	year	 = Integer.parseInt(inputStr);

	System.out.print("Month (1-12): ");
	inputStr = bufReader.readLine();
	month	 = Integer.parseInt(inputStr);

	System.out.print("Day (1-31): ");
	inputStr = bufReader.readLine();
	day	 = Integer.parseInt(inputStr);
	
	cal = new GregorianCalendar(year,month-1,day);
	sdf = new SimpleDateFormat("EEEE");

	System.out.println("");
	System.out.println("Day of Week: " + sdf.format(cal.getTime()));
	}
}

THANKS for ANY and all help!
(obviously im new to the forums and I apologize for the multiple posts/edits by myself in this thread. :o )

any help? :sad:

any help? :sad:

Give it just a bit! Maybe someone is checking over your code right now.

I'm not a Java programmer-- I just moderate the forum. Otherwise, I'd help :)

I am finishing up writing an extensive C/C++ program and am in dire need of completing these 4 short JAVA programs. Any help would be appreciated GREATLY! (I missed a few days of lecture and am extremely behind in this class.. :sad:
EDIT:
actually just helping me with one or two of these would be GREAT.. :o


1) Write a program that displays the recommended weight, given the user's age and height. The formula for calculating the recommended weight is:

recommendedWeight = (height - 100 + age % 10) * 0.90

Define a service class named Height and include an appropriate method for getting a recommended weight of a designated height.
-------------------------------------------------------------------

thanks for helping me by these coding i like this posting very much.

commented: Thanks so much for posting useless drivel to spam your sig links. It's so useful to no one. -2

I am finishing up writing an extensive C/C++ program and am in dire need of completing these 4 short JAVA programs. Any help would be appreciated GREATLY! (I missed a few days of lecture and am extremely behind in this class.. :sad:
EDIT:
actually just helping me with one or two of these would be GREAT.. :o


1) Write a program that displays the recommended weight, given the user's age and height. The formula for calculating the recommended weight is:

recommendedWeight = (height - 100 + age % 10) * 0.90

Define a service class named Height and include an appropriate method for getting a recommended weight of a designated height.
-------------------------------------------------------------------

First start a new thread.
Then write some code and post it. Surely you know how to define a class and declare a method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.