Preview

Java Progamming

Good Essays
Open Document
Open Document
7830 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java Progamming
yet another insignificant programming notes... | HOME
TABLE OF CONTENTS (HIDE)
1. Exercises on Flow Controls
1.1 Exercises on Conditional (Decision)
1.2 Exercises on Loop (Iteration)
1.3 Exercises on Nested-Loop
2. Exercises on Keyboard and File Input
3. Exercises on User Input and String Operations
4. Exercises on Array
5. Exercises on Command-line Arguments
6. Exercises on Method
7. More (Difficult) Exercises
8. Exercises on Number Theory
Java Programming Tutorial
Exercises on Java Basics
-------------------------------------------------
1. Exercises on Flow Controls
-------------------------------------------------
1.1 Exercises on Conditional (Decision)
Exercise CheckPassFail (if-else): Write a program called CheckPassFail which prints "PASS" if the int variable "mark" is more than or equal to 50; or prints "FAIL" otherwise.
Hints:
------------------------------------------------- public class CheckPassFail { // saved as "CheckPassFail.java"
-------------------------------------------------
public static void main(String[] args) {
-------------------------------------------------
int mark = 49; // set the value of mark here!
-------------------------------------------------
System.out.println("The mark is " + mark);
-------------------------------------------------

------------------------------------------------- if ( ...... ) {
-------------------------------------------------
System.out.println( ...... );
-------------------------------------------------
} else {
-------------------------------------------------
System.out.println( ...... );
-------------------------------------------------
}
-------------------------------------------------
}

You May Also Find These Documents Helpful

  • Powerful Essays

    JCT2 Task 1

    • 1659 Words
    • 8 Pages

    Supply Chain (JCT2) Task 1 Business Fundamentals Simulation Review A. Documents From Simulation Cumulative industry results for last four quarters ending in quarter: 4 Minimum Maximum Average Mr. Matts Machines Total Overall 0.00 749.39 11.82 1.75 Financial Performance -73.50 211.50 9.41 6.46 Market Performance 0.00 0.65 0.11 0.44 Marketing Effectiveness 0.00 0.82 0.24 0.67 Investment in Future 0.00 468.30 1.22 1.71 Wealth -2.12 5.21 0.47 0.93 Human Resource Management 0.00 0.82 0.25 0.77 Asset Management 0.00 2.63 0.38 0.78 Manufacturing Productivity 0.00 1.00 0.25 1.00 Financial Risk 0.00 1.00 0.32 0.95 Income Statement Quarter 1 Quarter 2 Quarter 3 Quarter 4 Gross Profit Revenues 0 1,643,600 3,600,500 4,298,600 - Rebates 0 48,700 101,800 123,000 - Cost of Goods Sold 0 1,237,849 2,174,294 2,500,626 =…

    • 1659 Words
    • 8 Pages
    Powerful Essays
  • Better Essays

    Jdt2 Task 1

    • 1786 Words
    • 8 Pages

    | Per your request to investigate and recommend Toy Company’s position regarding Claim #1-2013; this report was generated. The initial research has been finalized and recommendations determined. I will refer to the claim by its number #1-2013 and the claimant as AA23 to keep the confidentiality of the claimant. First this report will provide a summary of the claim and the history associated with it. Second it will discuss the definition of Constructive Discharge and its relevance to this claim. Third it will provide the specific areas under the Title VII of the Civil Rights Act of 1964. Fourth it will offer recommendations and supporting legal references. Fifth it will recommend proactive steps to avoid future legal issues in relationship to the Title VII of the Civil Rights Act of 1964. And finally any references used in this research will be provided. A. Definition of Constructive DischargeSummary of Claim and history:In January 1, 2013 a new policy was implemented to support exponential company growth. This policy impacted all production employees. The impacted employees were notified of the changes two months in advance of the January 2013 implementation to allow for assimilation and training on the new shifts schedules and there impacts. Production employee schedules were shifted from a Monday through Friday schedule, 8 hour shift to a Monday through Sunday schedule, 12 hour shift, four working days can occur any day of the week. This schedule requires all production employees to work on holy days regardless of religious affiliation as the production now runs seven days a week.Office staff members were not impacted by this policy change.AA23 quit on January 2, 2013 after new policy was in effect.…

    • 1786 Words
    • 8 Pages
    Better Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    9.Write a program to count the number of characters in an input line. Page: 105…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    JDT2 Task 1

    • 1672 Words
    • 6 Pages

    Title VII of the Civil Rights Act of 1964 protects employees from workplace discrimination on the basis of race, color, religion, sex and national origin. When an employer engages in practices that create a hostile work environment for any of these protected groups, making conditions so intolerable that an employee feels compelled to resign, it is known as constructive discharge Former employee Andy Anderson now alleges that our company engaged in religious discrimination when our production schedule changes went into effect at the first of the year. The changes required all production employees to occasionally work on a religious holy day, and Mr. Anderson has submitted a constructive discharge claim with the U.S. Equal Employment Opportunity Commission (EEOC).…

    • 1672 Words
    • 6 Pages
    Powerful Essays
  • Powerful Essays

    Java exam 1 practice test

    • 6434 Words
    • 53 Pages

    A set of instructions that enable the computer to solve a problem or perform a task…

    • 6434 Words
    • 53 Pages
    Powerful Essays
  • Good Essays

    JDT2 Task 3

    • 2402 Words
    • 8 Pages

    Higher employee satisfaction – When an appraisal is exquisitely prepared and well delivered employees are prone to respond better to the feedback presented. The employees also come away from the meeting with a clear understanding of their performance and where improvement is needed. They will also have good understanding of the company’s goals both for itself and for the employee themselves.…

    • 2402 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Java

    • 5076 Words
    • 21 Pages

    Explanation: B) Programs are classified as software to differentiate them from the mechanisms of the computer (hardware). Storage and the processor are two forms of hardware while input is the information that the program processes.…

    • 5076 Words
    • 21 Pages
    Good Essays
  • Satisfactory Essays

    Homework CH 1 Java

    • 723 Words
    • 5 Pages

    2. Languages that let you use a vocabulary of descriptive terms, such as read, write, or…

    • 723 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    Comparing Primitives vs Comparing Strings There is a difference Comparing Primitives • Primitives are compared with an operator: = = < <= > >= ! = //given…

    • 464 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    programiing

    • 923 Words
    • 4 Pages

    7: Write a program that requests two floating-point numbers and prints the value of their difference divided by their product. Have the program loop through pairs of input values until the user enters nonnumeric input.…

    • 923 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    1. Write a program in Java that allows the user to enter a number and then display its Pascal’s Triangle -The triangle is bordered by ones on the right and left sides, and each interior entry is the sum of the two entries above.…

    • 1391 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    Java Calculator CMD

    • 889 Words
    • 4 Pages

    import java.util. *; class pup { public static void main (String [] args) { int a,b,op; int c = 0; Scanner fSC = new Scanner(System.in); System.out.println("Welcome to CMD basic calculator!\n"+"Press ENTER key to continue . . ."); Scanner aKey = new Scanner(System.in); String akeyp = aKey.nextLine(); System.out.println("Enter first number:"); a = fSC.nextInt(); System.out.println("Input operator to be used( Ex. 1):\n"+"1. Addition\n"+"2. Subtraction\n"+"3. Multiplication\n"+"4.…

    • 889 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    java

    • 312 Words
    • 2 Pages

    AllocationStrategy.java import java.util. ArrayList; import java.util. Collection; import java.util. Iterator; import java.util. List; import java.util.…

    • 312 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Java

    • 2071 Words
    • 9 Pages

    The Next Gen IT Trends & Web Technologies – Course Plan - Version 1.1 is released for…

    • 2071 Words
    • 9 Pages
    Powerful Essays
  • Powerful Essays

    Computer Java

    • 1329 Words
    • 6 Pages

    1. Object Orientd Prrogramming : A type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an objectthat includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.…

    • 1329 Words
    • 6 Pages
    Powerful Essays