top of page

Forum Comments

7-1 Why prefix or post fix notations are used in computers?
In ACSL Contest Prep
8.1 What are bit strings? What do we use bit strings for?
In ACSL Contest Prep
1.1 Converting numbers among different bases
In ACSL Contest Prep
wangernestrdragon
Dec 15, 2018
1)42 2)21 3)20026 4)B 5)-12
0
0
3.1 What is a function? What is a recursive function?
In ACSL Contest Prep
wangernestrdragon
Dec 08, 2018
1) 79 2)6 3)345
1
0
7.1 What is a function or method?
In Introduction to Java
wangernestrdragon
Nov 17, 2018
import java.io.IOException; import java.io.FileReader; import java.util.*; class Hours { public static double getHours(int start, int end) { double hours=0; hours=((end-start)*0.5); return hours; } public static int getTime(String time) { int end = 0; switch(time) { case "A": end = 10;break; case "B": end = 11;break; case "C": end = 12;break; case "D": end = 13;break; case "E": end = 14;break; case "F": end = 15;break; case "G": end = 16;break; case "H": end = 17;break; default:end = Integer.parseInt(time); } return end; } public static double getRate(int location) { double rate = 0; if (location<=199 && location>=100) { rate = 10.00; } if (location<=299 && location>=200) { rate = 7.50; } if (location<=399 && location>=300) { rate = 9.25; } if (location<=499 && location>=400) { rate = 6.75; } if (location<=599 && location>=500) { rate = 8.00; } return rate; } public static double getORate(int location) { double Orate = 0; if (location<=199 && location>=100) { Orate = 15.00; } if (location<=299 && location>=200) { Orate = 15.00; } if (location<=399 && location>=300) { Orate = 10.50; } if (location<=499 && location>=400) { Orate = 13.50; } if (location<=599 && location>=500) { Orate = 12.00; } return Orate; } public static void main(String[] args)throws IOException { Scanner data =new Scanner(new FileReader("data/Data.TXT")); //for(int i = 0;i<4;i++) { for(int e = 0; e<2;e++) { int location = data.nextInt(); System.out.println(location); int day = data.nextInt(); System.out.println(day); double hours = getHours(getTime(data.next()),getTime(data.next())); System.out.println(hours); if (location<=199 && location>=100) { if (hours>5) { System.out.println((getORate(location)*(hours-5)+(5*getRate(location)))); } else { System.out.println((hours*getRate(location))); } } if (location<=299 && location>=200) { if (hours>6) { System.out.println((getORate(location)*(hours-5)+(5*getRate(location)))); } else { System.out.println((hours*getRate(location))); } } if (location<=399 && location>=300) { if (hours>4) { System.out.println((getORate(location)*(hours-5)+(5*getRate(location)))); } else { System.out.println((hours*getRate(location))); } } if (location<=499 && location>=400) { if (day==1||day==7) { System.out.println((getORate(location)*(hours))); } else { System.out.println((hours*getRate(location))); } } if (location<=599 && location>=500) { if (hours>6) { System.out.println((getORate(location)*(hours-6)+(6*getRate(location)))); } else { System.out.println((hours*getRate(location))); } } } data.nextLine(); System.out.println(); } } }
1
0
C9 Arrays and Loops in Actions
In Introduction to Java
Lab 1-2: a Robot - Classes and Objects Project
In AP Computer Science A
wangernestrdragon
Oct 20, 2018
What does j%5==2 mean again?
0
0
Classes and objects review: Project Draft Picks
In AP Computer Science A
wangernestrdragon
Oct 14, 2018
is the salary yearly?
0
0
2.12 - Conversion among binary, octal and hexadecimal numbers
In Introduction to Java
2.10 - What are binary numbers?
In Introduction to Java

wangernestrdragon

More actions
bottom of page