xxxxxxxxxx
65
let h, m, s
let hourly_rate = 50
let income
let userInput
function preload(){
//all images are created by manypixels.com, loyalty free
img1000 = loadImage('macbook.png');
img500 = loadImage('applewatch.png');
img300 = loadImage('traveling.png');
img100 = loadImage('gaming.png');
img20 = loadImage('lunch.png');
img0 = loadImage('default.png');
}
function setup() {
createCanvas(400, 400);
userInput = createInput('50','number');
userInput.position(42,120);
}
function draw() {
background(229,204,255);
hourly_rate = userInput.value();
h = hour()+2;
m = minute();
s = second();
income = h*hourly_rate+m*(hourly_rate/60)+s*(hourly_rate)/360
console.log(income);
fill(102,0,204);
textSize(30);
text('Time Is Gold',120,50);
translate(0,10);
textSize(15);
text('Type in your hourly rate here:',30,100)
text('$',30,125)
text('Daily Income:',30,210)
text('$'+income,130,210)
text('What you can afford:',30,300)
if (income >= 1000){
image(img1000,190,230);
}else if(income >=500){
image(img500,190,230);
}else if(income >=300){
image(img500,190,230);
}else if(income >=100){
image(img500,190,230);
}else if(income >=20){
image(img500,190,230);
}else{
image(img0,190,230);
}
}