Logout

## Semi-sophisticated Data Structure Algorithms

```10
11
12        //morePositveOrNegative(); TO DO
13
14        //moreEvenOrOdd(); TO DO
15
16        //largestOddAndEvenNumbers(); TO DO
17
18        calculatePay();
19    }
20
21    public static void calculatePay(){
22        //asssumes an hourly wage of \$20 per hour
23        //and salary is 1.5 x for overtime
24        //and employees are guaranteed the equivalent of 10 hours pay, so a minimum
25        //of \$200 per week, i.e. their salary if under 10 hours work is \$200
26        final double HOURLYWAGE = 20;
27        double [] hoursWorked = new double[50];
28        double totalPayThisWeek = 0;
29        for(int i = 0; i < hoursWorked.length; i++){
30            if(hoursWorked[i] > 40){
31             double overtimeHours = hoursWorked[i] - 40;
32                double pay = HOURLYWAGE * 40 + overtimeHours * 1.5 * HOURLYWAGE;
33                totalPayThisWeek += pay;
34            }else if(hoursWorked[i] < 10){
35                totalPayThisWeek += 200;
36            }else{
37                double pay = HOURLYWAGE * hoursWorked[i];
38                totalPayThisWeek += pay;
39            }
40        }
41    }```

asdd

```35
36
37        public static void main(String[] args) {
38
39        //Make an array of 365 daily temperatures ranging from 16 to 40 degrees Celsius.
40        //From it, make two lists, one of temperatures less than 20, and one temperatures
41        //more than 37. Send the lists to a method which prints out the chilli & hot temps.
42
43        OurList<Integer> chillyTemps = new OurList<Integer>();
44        OurList<Integer> hotHotHotTemps = new OurList<Integer>();
45        int [] allTemps = new int[365];
46        for(int i = 0; i < 365; i++){
47            allTemps[i] = (int)(Math.random() * 24 + 16);
48            if(allTemps[i] < 20){
50            }else if(allTemps[i] > 37){
52            }
53        }
54        printOutChilliAndHotTemps(chillyTemps, hotHotHotTemps);
55
56    }
57    public static void printOutChilliAndHotTemps(OurList<Integer> chilli, OurList<Integer> hot){
58        System.out.println("Chilliest temps:");
59        chilli.resetNext(); //even though not necessary
60        if(!chilli.ourIsEmpty()){
61           while(chilli.hasNext()){
62                System.out.print(chilli.getNext() + " ");
63            }
64        }
65        System.out.println();
66        System.out.println("Hotttt temps:");
67        hot.resetNext();
68        if(!hot.ourIsEmpty()){
69            while(hot.hasNext()){
70                System.out.print(hot.getNext() + " ");
71            }
72        }
73    }```

asddfsa