inital commit
This commit is contained in:
commit
aa37ae1eec
55 changed files with 3927 additions and 0 deletions
0
lab03/nbproject/private/jshell.history
Normal file
0
lab03/nbproject/private/jshell.history
Normal file
23
lab03/src/circleCalc.java
Normal file
23
lab03/src/circleCalc.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gabriel.venberg
|
||||
*/
|
||||
public class circleCalc {
|
||||
public static void main(String[] args){
|
||||
double radius=3.4;
|
||||
double area;
|
||||
double perimeter;
|
||||
|
||||
perimeter=(radius*2*Math.PI);
|
||||
area=(Math.pow(radius, 2)*Math.PI);
|
||||
|
||||
System.out.println("The perimeter is "+perimeter);
|
||||
System.out.println("The area is "+area);
|
||||
}
|
||||
}
|
51
lab03/src/tempConversion.java
Normal file
51
lab03/src/tempConversion.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Gabriel Venberg
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gabriel.venberg
|
||||
*/
|
||||
public class tempConversion {
|
||||
public static void main(String[] args) {
|
||||
|
||||
final double converCoeff = (double)5/(double)9;
|
||||
final int convertoffSet = 32;
|
||||
|
||||
//would be better to store as array and loop through array, but have not covered arrays yet.
|
||||
double f1=32;
|
||||
double f2=72;
|
||||
double f3=0;
|
||||
double f4=212;
|
||||
|
||||
double c1;
|
||||
double c2;
|
||||
double c3;
|
||||
double c4;
|
||||
|
||||
//again, it would be better to loop through the array here...
|
||||
c1=(converCoeff*(f1-convertoffSet));
|
||||
c2=(converCoeff*(f2-convertoffSet));
|
||||
c3=(converCoeff*(f3-convertoffSet));
|
||||
c4=(converCoeff*(f4-convertoffSet));
|
||||
|
||||
System.out.println(f1+" degrees F is "+c1+" degrees c");
|
||||
System.out.println(f2+" degrees F is "+c2+" degrees c");
|
||||
System.out.println(f3+" degrees F is "+c3+" degrees c");
|
||||
System.out.println(f4+" degrees F is "+c4+" degrees c");
|
||||
|
||||
}
|
||||
}
|
45
lab03/src/timeCalc.java
Normal file
45
lab03/src/timeCalc.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Gabriel Venberg
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gabriel.venberg
|
||||
*/
|
||||
public class timeCalc {
|
||||
public static void main(String[] args){
|
||||
final int secInHour=3600;
|
||||
final int secInMin=60;
|
||||
|
||||
int inputSec=8732;
|
||||
|
||||
int outputHour;
|
||||
int outputMin;
|
||||
int outputSec;
|
||||
|
||||
//hours
|
||||
outputHour=inputSec/secInHour;
|
||||
//remainder in sec
|
||||
outputSec=inputSec%secInHour;
|
||||
//minutes
|
||||
outputMin=outputSec/secInMin;
|
||||
//remainder in sec
|
||||
outputSec=outputSec%secInMin;
|
||||
|
||||
System.out.println(inputSec+" seconds is equal to "+outputHour+":"+outputMin+":"+outputSec);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue