Skip to main content

Posts

Showing posts from December, 2014

A for Loop in Java example

public class ForElevator {  public boolean doorOpen=false;  public int currentFloor = 1;  public int weight = 0;  public final int CAPACITY = 1000;  public final int TOP_FLOOR = 5;  public final int BOTTOM_FLOOR = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”);  }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”);  }  public void goUp() {  System.out.println(“Going up one floor.”);  currentFloor++;  System.out.println(“Floor: “ + currentFloor);  }  public void goDown() {  System.out.println(“Going down one floor.”);  currentFloor--;  System.out.println(“Floor: “ + currentFloor);  }  public void setFloor() {  // Normally you would pass the desiredFloor as an argument to the  // setFloor method. However, because you have not learned how to  // do this yet, desiredFloor is set to a specific number (5)  /

Nested while Loops in Java example

 public class WhileElevator { public boolean doorOpen=false;  public int currentFloor = 1;  public int weight = 0;  public final int CAPACITY = 1000;  public final int TOP_FLOOR = 5;  public final int BOTTOM_FLOOR = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”);  }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”);  }  public void goUp() {  System.out.println(“Going up one floor.”);  currentFloor++;  System.out.println(“Floor: “ + currentFloor);  }  public void goDown() {  System.out.println(“Going down one floor.”);  currentFloor--;  System.out.println(“Floor: “ + currentFloor);  }  public void setFloor() {  // Normally you would pass the desiredFloor as an argument to the  // setFloor method. However, because you have not learned how to  // do this yet, desiredFloor is set to a specific number (5)

Creating while Loops in Java example

public class WhileElevator {  public boolean doorOpen=false; public int currentFloor = 1;  public int weight = 0;  public final int CAPACITY = 1000;  public final int TOP_FLOOR = 5;  public final int BOTTOM_FLOOR = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”);  }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”);  } public void goUp() {  System.out.println(“Going up one floor.”);  currentFloor++;  System.out.println(“Floor: “ + currentFloor);  }  public void goDown() {  System.out.println(“Going down one floor.”);  currentFloor--; System.out.println(“Floor: “ + currentFloor);  }  public void setFloor() {  // Normally you would pass the desiredFloor as an argument to the  // setFloor method. However, because you have not learned how to  // do this yet, desiredFloor is set to a specific number (5)  //

Nested if Statements in Java example

public class NestedIfElevator { public boolean doorOpen=false; // Doors are closed by default  public int currentFloor = 1; // All elevators start on first floor  public final int MAX_FLOORS = 10;  public final int MIN_FLOORS = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”);  }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”);  }  public void goUp() {  System.out.println(“Going up one floor.”);  currentFloor++;  System.out.println(“Floor: “ + currentFloor);  }  public void goDown() {  if (currentFloor == MIN_FLOORS) {  System.out.println(“Cannot Go down”);  }  if (currentFloor > MIN_FLOORS) {  if (!doorOpen) {  System.out.println(“Going down one floor.”);  currentFloor--;  System.out.println(“Floor: “ + currentFloor);  }  }  }  public int getFloor() {  return currentFloor;  }  public boolea

Using If in Java an example

public class IfElevator {  public boolean doorOpen=false; // Doors are closed by default public int currentFloor = 1; // All elevators start on first floor public final int MAX_FLOORS = 10;  public final int MIN_FLOORS = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”);  }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”); }  public void goUp() {  System.out.println(“Going up one floor.”); currentFloor++; System.out.println(“Floor: “ + currentFloor); } public void goDown() { if (currentFloor == MIN_FLOORS) {  System.out.println(“Cannot Go down”); }  if (currentFloor > MIN_FLOORS) {  System.out.println(“Going down one floor.”);  currentFloor--;  System.out.println(“Floor: “ + currentFloor); } }  public int getFloor() {  return currentFloor; }  public boolean checkDoorStatus() { return door

What are Uses for Variables ?

• Holding unique data for an object instance • Assigning the value of one variable to another • Representing values within a mathematical expression • Printing the values to the screen • Holding references to other objects Naming a Variable • Rules: • Variable identifiers must start with either an uppercase or lowercase letter, an underscore (_), or a dollar sign ($). • Variable identifiers cannot contain punctuation, spaces, or dashes. • Guidelines: • Begin each variable with a lowercase letter; subsequent words should be capitalized, such as myVariable. • Chose names that are mnemonic and that indicate to the casual observer the intent of the variable.

What is Big Data ?

Many people believe Big Data is simply a large amount of data, but it is defined by more than just size. Gartner Definition of Big Data is :" Big Data are high-volume, high-velocity, and/or high-variety information assets that require new forms of processing to  enable enhanced decision making, insight discovery and  process optimization. " Big Data is described within the Gartner definition based on the three Vs:  Volume: Size of data (how big it is)  Velocity: How fast data is being generated  Variety: Variation of data types to include source, format, and structure In terms of the three Vs, the Gartner definition effectively says that: "There is a lot of data, it is coming into the system rapidly,  and it comes from many different sources in many different  formats." IT companies are investing billions of dollars into research and development for Big Data, Business Intelligence (BI), data mining, and analytic processing technologies. This fact und

The if/else Construct in Java Example

 public class IfElseElevator {  public boolean doorOpen=false; // Doors are closed by default  public int currentFloor = 1; // All elevators start on first floor  public final int MAX_FLOORS = 10;  public final int MIN_FLOORS = 1;  public void openDoor() {  System.out.println(“Opening door.”);  doorOpen = true;  System.out.println(“Door is open.”); }  public void closeDoor() {  System.out.println(“Closing door.”);  doorOpen = false;  System.out.println(“Door is closed.”);  }  public void goUp() {  System.out.println(“Going up one floor.”);  currentFloor++;  System.out.println(“Floor: “ + currentFloor);  }  public void goDown() {  if (currentFloor == MIN_FLOORS) {  System.out.println(“Cannot Go down”); } else {  System.out.println(“Going down one floor.”);  currentFloor--;  System.out.println(“Floor: “ + currentFloor);  }  }  public int getFloor() {  return currentFloor;  }  public boolean checkDoorStatus() {  return doorOpen;  }  }

Product Life Cycle (PLC) Stages

The Product Life Cycle (PLC) is based upon the biological life cycle. For example, a seed is planted (introduction); it begins to sprout (growth); it shoots out leaves and puts down roots as it becomes an adult (maturity); after a long period as an adult the plant begins to shrink and die out (decline). Each product may have a different life cycle PLC determines revenue earned Contributes to strategic marketing planning May help the firm to identify when a product needs support, redesign, reinvigorating, withdrawal, etc. May help in new product development planning May help in forecasting and managing cash flow 1. Analysis 2. Design 3. Development 4. Testing 5. Implementation 6. Maintenance 7. End-of-life (EOL)