top-rated free essay

Java Hw

By kleriotisc Apr 15, 2014 305 Words
Java I Programming

ITP 120 Section 002W
Spring 2014
Homework Assignment 1

Due: January 22, 2014 or January 29, 2014 (your choice)
Guidelines: Turn in your homework (both the .java & .class files) and hardcopy source program printouts and USB flash drive. Suggestion: Use Notepad or Notepad++ for your text editor. Be sure to use proper naming conventions such as:

EX1_10Wilson.java and EX1_11Wilson.java

(1)Complete these Chapter 1 Programming Exercises on page 32

1.10 (Average speed in miles) (50 points)
Use this formula in your program:
double mph = ( (14 * (60/45.5))/1.6); // That is, (km / hr) / (1.6 km / mile)

1.11 (Population projection) (50 points) http://www.worldometers.info/world-population/ (The world population in December 2013 is 7,200,000,000 and climbing!)
public class {

public static void main(String[] args) {

int startPop = 312023486;
int newPop;
int birthRate = 7;
int deathRate = 13;
int immigrationRate = 45;
int seconds = 31536000;
int years;
int startYear = 2012;
int endYear = 2017;
int more;
int births;
int deaths;
int imm;

years = endYear - startYear;

seconds = 365 * 24 * 60 * 60;

startPop = 312032486;
System.out.println("Current Population: " + startPop);

births = seconds / birthRate * years;
System.out.println("New Born total in five Years: " + births);

deaths = seconds / deathRate * years;
System.out.println("Death total in five Years: " + deaths);

imm = seconds / immigrationRate * years;
System.out.println("Immigration total in five Years: " + imm);

more = births + imm - deaths;
System.out.println("Accumulated Total in five Years: " + more);

newPop = startPop + more;
System.out.println("New Population in five Years: " + newPop);

}// end method

}// end of class

public class {

public static void main (String[] args) {

double mph;

mph = ((14 * (60/45.5))/1.6);

System.out.println("Speed in miles per hour:" + mph);

}// end method
}// end of class

public class
{
public static void main (String [] args)
{

int startPop= 312032486;
int addPeople = 0;
int newPop;
int birthRate = 7;
int deathRate = 13;
int immigrationRate = 45;
int seconds;
int years;
int startYear = 2012;
int endYear = 2017;
int more;
int births;
int deaths;
int imm;

years = endYear - startYear;

seconds = 365 * 24 * 60 * 60;

births = seconds / birthRate;
deaths = seconds / deathRate;
imm = seconds /immigrationRate;

more = births + imm - deaths;
int pop = startPop;

for (int i = 0; i

Cite This Document

Related Documents

  • JAVA

    ...same time. At this time there comes a language called Java and eventually in 1994 after the failure of Interactive TV Java project team switched their focus to the web. On May 23rd 1995 the director of Sun Microsystems along with co-founder and executive vice president Netscape announced to the world about the Java. There is only 30 pepole team ...

    Read More
  • Java

    ...Java Language Programming Basic Programming Elements Tiberiu Leţia: Software Engineering –Java Programming Language – Programming Basic Elements 1 Content 1. Stand alone applications and mini-applications 2. Name and identifiers 3. Java program structure 4. Data types 5. Operators 6. Flow execution control Tiberiu Leţia: Soft...

    Read More
  • Java

    ...transferred part by part from RAM into the CPU. The CPU is divided into Logic Unit – to deal with general execution (in and out) and Arithmetic Logic Unit – to deal with instruction related to mathematical calculation. The CPU also has a set of memory/cache hierarchy usually referred to as register, L1 and L2. From programmer point of view, ...

    Read More
  • Java Project

    ...motivated. Believe on discipline STRENGTHS: Qualification Year of Passing School/College Board/University Percentage M.C.A 2011-14 I.P.S.Academy Indore RGPV(Bhopal) 7.51 Pointers B.C.A 2008-11 Ojaswini Institute Par Excellence Damoh (M.P) Dr. Hari Singh Gour University Sagar 73.48% 10+2 2008 Govt. H.S.Excel.Schoo...

    Read More
  • Java Cis Assignment 1

    ...Java CIS 109 Assignment 1 A. Programming theory 1. Basic Ideas 1(a) Delimiters are used as comments. The Phrase is put in there to be shown to the user whilst programming, but is not shown when the program is to run. Those delimeters indicate comments, the compiler ignores what is inside. 1(b) “import java.io*;” means that the ...

    Read More
  • Key Words in Java

    ...Java KeywordsBy Barry Burd Part of the Java For Dummies Cheat Sheet The 50 Java keywords have specific meanings within the language, so you can’t use the keywords in this table for anything other than their function within Java. And, you can't make up new meanings for the words false, null, and true, either. But for technical reasons, those ...

    Read More
  • Compare and Contrast Java and Javascript

    ...Compare and Contrast Java and JavaScript WEB/420 Web Programming II Mr. Caleb Green January 31, 2007 TEAMS MEMBER: Gladys Burton, Kassindra Davidson, Corine Holmes, Christina Kennedy, James Mustin, Josh Sheppard, Lura Wade Contrary to a vast amount of opinions and thinking Java and JavaScrip...

    Read More
  • Rational Number Class in Java

    ...RATIONAL NUMBER CLASS IN JAVA AIM To write a program to find the rational form of rational number. ALGORITHM 1. Start the program. 2. Declare the class name as rational and assign num, den as two parameters. 3. Declare constructor as rational and numerator and denominator as parameter. 4. Then write to string () method...

    Read More

Discover the Best Free Essays on StudyMode

Conquer writer's block once and for all.

High Quality Essays

Our library contains thousands of carefully selected free research papers and essays.

Popular Topics

No matter the topic you're researching, chances are we have it covered.