Top-Rated Free Essay
Preview

Java Hw

Good Essays
305 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java Hw
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

You May Also Find These Documents Helpful

  • Good Essays

    PRG/420 Week 3

    • 1025 Words
    • 5 Pages

    /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package commission2; import java.lang. *; import java.text. DecimalFormat; import java.util.…

    • 1025 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Once you have worked through the problems, please post your responses to the Dropbox. Please refer to the course Syllabus for the due date.…

    • 668 Words
    • 20 Pages
    Satisfactory Essays
  • Better Essays

    Save a copy of your assignments: You may need to re-submit an assignment at your instructor’s request. Make sure you save your files in accessible location.…

    • 861 Words
    • 4 Pages
    Better Essays
  • Good Essays

    SCC3

    • 1250 Words
    • 5 Pages

    Please submit a typed, hardcopy of your solution sentences for grading at the beginning of class on the posted due date. Type your solution sentences immediately underneath the originals on this assignment handout. Please also retain a softcopy of the completed document and place it in your SmartSite DropBox using the file name 102e_graded_exercise_SCC02_rev_c_<your email name>.doc—e.g., "102e_graded_exercise_SCC02_rev_c_bhenderson.doc."…

    • 1250 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    PROJ 586 W4 Homework

    • 588 Words
    • 3 Pages

    Once you have worked through the problems, please post your responses to the Dropbox. Please refer to the course Syllabus for the due date.…

    • 588 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    RomineHBTM8102 1

    • 1747 Words
    • 6 Pages

    Save a copy of your assignments: You may need to re-submit an assignment at your instructor’s request. Make sure you save your files in accessible location.…

    • 1747 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    jdsdkldwnls

    • 1012 Words
    • 3 Pages

    Ambrose Weeres was born and raised in Minnesota, the land of 10,000 lakes, and grew to become a farmer who wanted a more sturdy boat. With some experimenting, the pontoon was born, calling the first prototype The Empress. Ambrose made more and generously sold them throughout the area, but the small shop Ambrose worked in was not spacious enough for the large number of orders coming in, so he opened the Weeres Pontoon Boat Company in 1952. Although the beginning was hard, Ambrose went on to also create the first water bike, or paddle bike, and the idea of the pontoon inspired the idea of military bridges. Even after Ambrose retired and put his business into new hands, Weeres Pontoon Co. has sold over 30,000 pontoons today for fun and leisure out on the lake.…

    • 1012 Words
    • 3 Pages
    Good Essays
  • Best Essays

    Admn233 Assignment4

    • 3300 Words
    • 14 Pages

    Refer as needed to material in Chapters 12 and 13. Read the instructions carefully and answer all questions clearly and concisely. Include examples to highlight your comments.…

    • 3300 Words
    • 14 Pages
    Best Essays
  • Satisfactory Essays

    code program

    • 317 Words
    • 2 Pages

    (Design, approach, lessons learned) - Write a summary of the design of your program, how you coded it, and the lessons you learned from the programming assignment here: Well first of all I started by copying my hello world code into the notepad text editor. You know learning something new like Java at first is a little scary but I think going forward I will get more understanding of this application with no problems at all. So I learned to just hang in there and keep learning.…

    • 317 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Write the final draft of your project. Be sure to follow these requirements and recommendations when completing your draft:…

    • 421 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    After completing both sections, submit your work to your instructor by using the Drop Box on page 4.…

    • 343 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Prg420 Syllabus

    • 1691 Words
    • 7 Pages

    Horton, I. (2005). Ivor Horton’s Beginning Java 2, JDK (5th ed.). Indianapolis, IN: Wiley Publishing.…

    • 1691 Words
    • 7 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Management 605

    • 619 Words
    • 4 Pages

    Read and answer the questions for Errors in Design. Be prepared to discuss in class and post to drop box.…

    • 619 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    itech5401

    • 582 Words
    • 3 Pages

    You are required to provide written answers to each week’s tutorial questions. The due date for providing answers to each week’s tutorial tasks is by the beginning of your following week’s tutorial session. Make sure to submit your answers to the tutorial questions by its due date electronically using Moodle; and to take with you a printed/hand-written copy of your answers to the next tutorial session. For some questions your tutor may randomly select students to share their answers with the class. For some other questions, your tutor may invite students to discuss their written answers in groups and may ask you to present your group’s collective responses to the class.…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Java

    • 490 Words
    • 3 Pages

    Write a Java program to demonstrate using bitmaps and bitwise operators to sort and remove duplicates from a file of random phone numbers. Do not confuse the term bitmap used for compressing data into smaller spaces with the bitmap that has come to mean a graphic image.…

    • 490 Words
    • 3 Pages
    Good Essays