project 1:

project 2:

partner project:

Game:

Alice final project (modified version of the game):

Java Project1:

/Andys Payrole Program
**/import
java.util.Scanner;

publicclass payrole_program {


publicstaticvoid main(String[] args) {


Scanner input =
new Scanner( System.in );


System.
out.println("Please enter your hourly rate"); This asks the user to enter the hourly wage for that employee

double rate = input.nextDouble();

System.
out.println("Please enter your hours worked"); This asks the user to input how many hours the employee worked for that week.


double hours = input.nextDouble();

System.
out.println("Your total pay for this week"); This tells the user that the following displayed information is the employee's

double total_pay = (hours*rate);


System.
out.printf("The total pay is $%.2f", total_pay);


System.
out.println("Good job!");

System.
out.println("NOW GET BACK TO WORK!!!");

}
}

Chapter 8 project:


import

java.util.Scanner;




publicclass cylinderVolume {


/
By: Andy SageChapter 8 Project*/
publicstaticvoid main(String[] args) {

Scanner keyboard =
new Scanner(System.
in);


/ It now asks for the radius of the cylinder
*/
System.
out.println("What is the radius of the cylinder that you are trying to find the area of? ");


double radius = keyboard.nextDouble();


/
It now ask for the height of the cylinder

*/System.
out.println("Now what is the height of the cylinder? ");


double height = keyboard.nextDouble();

/Pi variable
*/
double Pi = 22/7;


/
calculate area of cylinder

*/
double area = Pi*radius*radius*height;

System.
out.print("The area of the cylinder that you are finding the area of is " + area);


System.
out//.print("Your Welcome!!!!!");

}
}

chapter 9 book work:



import java.util.Scanner;


publicclass BaloonPrank {


publicstaticvoid main(String [] args) {


roommate's bedroom dimensions (in feet)


finaldouble LENGTH = 9.0;

finaldouble WIDTH = 8.0;

finaldouble HEIGHT = 7.0;

get the balloon radius



System.

out.print("Enter a balloon radius in inches:");



Scanner keyboard =

new Scanner (System.in);


double balloonRadius = keyboard.nextDouble();



balloonRadius /= 12.0;

convert inches to feet


Sphere balloon =
newSphere (balloonRadius) ;

Box bedroom =
newBox (LENGTH, WIDTH, HEIGHT);

compute balloons in bedroom


double balloonsRequired = bedroom.volume() /balloon.volume();



System.

out.printf ("Using balloons of radius %.Of inches," + "you will need %.Ofballoons", balloonRadius*12, balloonsRequired) ; }}


JAVA FINAL PROJECT:


 


publicclass finals extends Microcontroller {



private MultiDigitLedDisplay ledDisplay;

sets led display type

private Port segmentPort = getHardware().getPort("D");



private Port commonPort = getHardware().getPort("C");



private Pin common0 = commonPort.getPin(1);



private Pin common1 = commonPort.getPin(2);



private Pin common2 = commonPort.getPin(3);



private Pin common3 = commonPort.getPin(4);



private Timer ledDisplayTimer;


sets display time

publicvoid init() {


getHardware().setAllPortsDirection(Pin.IN); }


getHardware().setAllPortsPullUp(


true);



ledDisplay =


new MultiDigitLedDisplay(true, //common anode



segmentPort, common0, common1, common2, common3);


ledDisplayTimer = getHardware().getDefaultTimer(8);


ledDisplayTimer.setMode(TimerMode.NORMAL);


ledDisplayTimer.setPrescaling(8);


ledDisplayTimer.setEnabled(


true);



LedDisplayDigitMultiplexer multiplexer =


new LedDisplayDigitMultiplexer();



ledDisplayTimer.addTimerListener(multiplexer);


ledDisplayTimer.setTimerOverflowedFired(


true);



}


publicvoid start() {



ledDisplay.setDigitValue(0, 0);



ledDisplay.setDigitValue(1, 0);



ledDisplay.setDigitValue(2, 0);



ledDisplay.setDigitValue(3, 0);



getHardware().setInterruptsEnabled(


true);



for(;;)


{


for(int digit = 0; digit < 4; digit++)



{


int value = ledDisplay.getDigitValue(digit);



if(++value > 10) value = 0;



ledDisplay.setDigitValue(digit, value);



getHardware().getDelay().sleep(250);

}

}

}


privateclass LedDisplayDigitMultiplexer implements TimerListener


{


publicvoid timerOverflowed()



{


ledDisplay.processMultiplexing();


}

}

}