
*calculated using the average life expectancy for males in The Netherlands
package project6;
import java.io.*;
import javax.swing.JOptionPane;
class distance {
private double speed;
private double time;
public distance(double a, double b) {
speed = a;
time = b;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double a) {
speed = a;
}
public double getTime() {
return time;
}
public void setTime(double b) {
time = b;
}
public double getDistance() {
return speed * time;
}
}
/**
* happy birthday?
*/
public class Project6 {
public static void main(String[] args) throws IOException {
double speed;
double time;
do {
String speedw = JOptionPane.showInputDialog("Please enter a speed");
String timew = JOptionPane.showInputDialog("Please enter a time");
speed = Double.parseDouble(speedw);
time = Double.parseDouble(timew);
} while (speed < 0 || time < 1);
distance distance1 = new distance(speed, time);
PrintWriter pw = new PrintWriter("myFile.txt");
pw.println("Hours Distance");
for (int i = 1; i <= time; i++) {
distance1.setTime(i);
pw.println(distance1.getTime() + " " + distance1.getDistance());
}
pw.close();
}
}
(d=document).body.appendChild(p=d.createElement("pre")),i=0,(a=x=>{for(p[q="innerText"]="",j=20;--j;)p[q]+=(j-i?j>i|j+8<i?"":" "+")("[(i+j)%2]:' .-"-. \n| |\n -.,.- ')+"\n";++i<20?setTimeout(a,99):p[q]+="happy birthday, PT_!"})();
q=0,setInterval(l=>{q++,document.body.innerHTML=atob("SGFwcHkgQmlydGhkYXkgUFRfIQ==").split("").map((l,o)=>'<f style="color:hsl('+360*(o+q)/50+',100%,50%)">'+l+"</f>").join("")},20);
s=[atob("SGFwcHkgQmlydGhkYXkgUFRfIQ==")];q=0,a=x=>{q++;document.body.innerHTML=s.map((x,j)=>x.split('').map((x,i,a)=>'<f style="color:hsl('+(360*(i+q+j))/50+',100'+'%,50%)">'+x+'</f>').join(''))}
setInterval(a,20);
[i]BDAY
Begin()
SetTextFGColor(255
SetTextBGColor(0
Call A
End //gfx
Lbl A
SetTextFGColor(randInt(1,255
PrintStringXY("Happy B-Day!!",0,0
ZeroScreen()
Pause 1000
Return
// Program Name: Birthday
// Author(s): epsilon5
// Description: says happy birthday
/* Keep these headers */
#define FORCE_INTERRUPTS
#include <tice.h>
/* Standard headers - it's recommended to leave them included */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
/* Other available headers */
// including stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h
/* Available libraries */
// including lib/ce/graphc.h, lib/ce/fileioc.h, and lib/ce/keypadc.h
// Sample: #include <lib/ce/graphc.h>
#include <graphx.h>
#include <fileioc.h>
#include <keypadc.h>
#include <intce.h>
#include <tice.h>
#include <math.h>
void main(void) {
gfx_Begin();
gfx_SetDraw(1);
gfx_SetTextScale(2, 2);
while (!(kb_Data[6] & kb_Enter)) {
kb_Scan();
gfx_FillScreen(randInt(0, 255));
gfx_SetTextFGColor(randInt(0, 255));
gfx_PrintStringXY("Happy birthday PT_!", 5, 5);
gfx_SwapDraw();
}
gfx_End();
}
Advertisement