Reorganize repository
This commit is contained in:
14
Assignments/03_Sep13_2022/pom.xml
Normal file
14
Assignments/03_Sep13_2022/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot._sep13_2022</groupId>
|
||||
<artifactId>03_Sep13_2022</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot._sep13_2022.App</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot._sep13_2022;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
import java.util.Scanner;
|
||||
|
||||
public class LeapYear {
|
||||
public static void main(String[] args) {
|
||||
// Create a Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter a year: ");
|
||||
int year = input.nextInt();
|
||||
|
||||
// Check if the year is a leap year
|
||||
boolean isLeapYear =
|
||||
(year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
|
||||
|
||||
// Display the result in a message dialog box
|
||||
System.out.println(year + " is a leap year? " + isLeapYear);
|
||||
}
|
||||
}
|
Binary file not shown.
@@ -0,0 +1 @@
|
||||
com/calebfontenot/_sep13_2022/LeapYear.class
|
@@ -0,0 +1 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/03_Sep13_2022/src/main/java/com/calebfontenot/_sep13_2022/LeapYear.java
|
14
Assignments/Lab1/pom.xml
Normal file
14
Assignments/Lab1/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab1</groupId>
|
||||
<artifactId>Lab1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab1.Lab1</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.lab1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String message = "Hello World";
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
14
Assignments/Lab1CalebFontenot/pom.xml
Normal file
14
Assignments/Lab1CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab1calebfontenot</groupId>
|
||||
<artifactId>Lab1CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab1calebfontenot.Lab1CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class ShowLogicErrors {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Celsius 35 is Fahrenheit degree ");
|
||||
System.out.println((9 / 5) * 35 + 32);
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab1calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab1CalebFontenot {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create a string named message
|
||||
String message = "Hello World!";
|
||||
// Print our string
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
15
Assignments/Lab1CalebFontenot/src/main/java/test.java
Normal file
15
Assignments/Lab1CalebFontenot/src/main/java/test.java
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class test {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("Hello world 2");
|
||||
}
|
||||
}
|
Binary file not shown.
BIN
Assignments/Lab1CalebFontenot/target/classes/NewClass.class
Normal file
BIN
Assignments/Lab1CalebFontenot/target/classes/NewClass.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Assignments/Lab1CalebFontenot/target/classes/test.class
Normal file
BIN
Assignments/Lab1CalebFontenot/target/classes/test.class
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Tue Aug 16 11:12:43 CDT 2022
|
||||
artifactId=Lab1CalebFontenot
|
||||
groupId=com.calebfontenot.lab1calebfontenot
|
||||
version=1.0-SNAPSHOT
|
@@ -0,0 +1 @@
|
||||
com/calebfontenot/lab1calebfontenot/Lab1CalebFontenot.class
|
@@ -0,0 +1 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab1CalebFontenot/src/main/java/com/calebfontenot/lab1calebfontenot/Lab1CalebFontenot.java
|
14
Assignments/Lab2CalebFontenot/lab2CalebFontenot/pom.xml
Normal file
14
Assignments/Lab2CalebFontenot/lab2CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab2calebfontenot</groupId>
|
||||
<artifactId>lab2CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab2calebfontenot.Lab2CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class ComputeExpression {
|
||||
public static void main(String[] args) {
|
||||
System.out.print("(10.5 + 2 * 3) / (45 – 3.5) = ");
|
||||
System.out.println((10.5 + 2 * 3) / (45 - 3.5));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class ShowLogicErrors {
|
||||
public static void main(String[] args) {
|
||||
System.out.print("Celsius 35 is Fahrenheit degree ");
|
||||
System.out.println((9.0 / 5) * 35 + 32);
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
// ShowRuntimeErrors.java: Program contains runtime errors
|
||||
public class ShowRuntimeErrors {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(1 / 0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class ShowSyntaxErrors {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("Welcome to Java");
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class WelcomeWithThreeMessages {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("Programming is fun!");
|
||||
System.out.println("Fundamentals First");
|
||||
System.out.println("Problem Driven");
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.lab2calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab2CalebFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/lab2calebfontenot/Lab2CalebFontenot.class
|
||||
WelcomeWithThreeMessages.class
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab2CalebFontenot/lab2CalebFontenot/src/main/java/WelcomeWithThreeMessages.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab2CalebFontenot/lab2CalebFontenot/src/main/java/com/calebfontenot/lab2calebfontenot/Lab2CalebFontenot.java
|
14
Assignments/Lab3CalebFontenot/pom.xml
Normal file
14
Assignments/Lab3CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab3calebfontenot</groupId>
|
||||
<artifactId>Lab3CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab3calebfontenot.Lab3CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Exercise01_04 {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("a a^2 a^3");
|
||||
System.out.println("1 1 1");
|
||||
System.out.println("2 4 8");
|
||||
System.out.println("3 9 27");
|
||||
System.out.println("4 16 64");
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Exercise01_06 {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Exercise01_07 {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(4 * (1.0 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11)));
|
||||
System.out.println(4 * (1.0 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11) + (1.0/13)));
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Exercise01_11 {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
double Population = 312032486.0;
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
//One birth every 7 seconds
|
||||
Population += ((60 * 60 * 24 * 365) / 7.0);
|
||||
//One death every 13 seconds
|
||||
Population -= ((60 * 60 * 24 * 365) / 13.0);
|
||||
//One new immigrant every 45 seconds
|
||||
Population += ((60 * 60 * 24 * 365) / 45.0);
|
||||
System.out.println(Population);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.lab3calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab3CalebFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_04.class
Normal file
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_04.class
Normal file
Binary file not shown.
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_06.class
Normal file
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_06.class
Normal file
Binary file not shown.
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_07.class
Normal file
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_07.class
Normal file
Binary file not shown.
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_11.class
Normal file
BIN
Assignments/Lab3CalebFontenot/target/classes/Exercise01_11.class
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/lab3calebfontenot/Lab3CalebFontenot.class
|
||||
Exercise01_04.class
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab3CalebFontenot/src/main/java/Exercise01_04.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab3CalebFontenot/src/main/java/com/calebfontenot/lab3calebfontenot/Lab3CalebFontenot.java
|
14
Assignments/Lab3_1_CalebFontenot/pom.xml
Normal file
14
Assignments/Lab3_1_CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab3_1_calebfontenot</groupId>
|
||||
<artifactId>Lab3_1_CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab3_1_calebfontenot.Lab3_1_CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab3_1_calebfontenot;
|
||||
import java.util.Scanner;
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab3 {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create a scanner object
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Prompt for hight in feet
|
||||
System.out.print("Enter the height (feet): ");
|
||||
double height;
|
||||
height = input.nextDouble();
|
||||
|
||||
// Prompt for width in feet
|
||||
System.out.print("Enter the width (feet):");
|
||||
double width;
|
||||
width = input.nextDouble();
|
||||
|
||||
// Calculate the area
|
||||
double area;
|
||||
area = height * width;
|
||||
// Print area calculated
|
||||
System.out.println("Calculated area is "+area);
|
||||
//create constants
|
||||
final double GALLONS_PER_SQUARE_FEET = 150.0;
|
||||
|
||||
// calculate the gallons
|
||||
double gallons;
|
||||
gallons = area/GALLONS_PER_SQUARE_FEET;
|
||||
//calculate the number of gallons needed to paint the wall
|
||||
System.out.println("The amount of paint is " + gallons +" gallons.");
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab3_1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class MilesToKilometers {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
double miles;
|
||||
double km;
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
//> 1. Prompt the user to enter the number of miles
|
||||
System.out.println("Please enter miles to convert into kilometers");
|
||||
//> 2. Read the miles and store it into a variable
|
||||
miles = scanner.nextDouble();
|
||||
//> 3. Calculate the KM from the entered miles
|
||||
km = miles * 1.67;
|
||||
//> 4. Display the result
|
||||
System.out.println("You entered "+miles+" miles which is "+km+" kilometers");
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.calebfontenot.lab3_1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class RunwayLength {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
//Define data objects
|
||||
double length;
|
||||
double acceleration;
|
||||
double velocity;
|
||||
|
||||
//Create scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
//Prompt for input
|
||||
System.out.print("Enter velocity: ");
|
||||
velocity = input.nextDouble();
|
||||
System.out.print("Enter acceleration: ");
|
||||
acceleration = input.nextDouble();
|
||||
|
||||
//Calculate
|
||||
length = Math.pow(velocity, 2) / (2 * acceleration);
|
||||
|
||||
//Print calculation
|
||||
System.out.println("The minimum runway length for this airplane is "+length);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/lab3_1_calebfontenot/MilesToKilometers.class
|
||||
com/calebfontenot/lab3_1_calebfontenot/Lab3_1_CalebFontenot.class
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab3_1_CalebFontenot/src/main/java/com/calebfontenot/lab3_1_calebfontenot/Lab3_1_CalebFontenot.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab3_1_CalebFontenot/src/main/java/com/calebfontenot/lab3_1_calebfontenot/MilesToKilometers.java
|
14
Assignments/Lab4_1/pom.xml
Normal file
14
Assignments/Lab4_1/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.lab4_1</groupId>
|
||||
<artifactId>Lab4_1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab4_1.Lab4_1</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab4_1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
import java.util.Scanner;
|
||||
|
||||
public class DisplayTime {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner input = new Scanner(System.in);
|
||||
// Prompt the user for input
|
||||
System.out.print("Enter an integer for seconds: ");
|
||||
int seconds = input.nextInt();
|
||||
|
||||
int minutes = seconds / 60; // Find minutes in seconds
|
||||
int remainingSeconds = seconds % 60; // Seconds remaining
|
||||
System.out.println(seconds + " seconds is " + minutes
|
||||
+ " minutes and " + remainingSeconds + " seconds");
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.lab4_1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab4_1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab4_1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SalesTax {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
System.out.print("Enter purchase amount: ");
|
||||
double purchaseAmount = input.nextDouble();
|
||||
|
||||
double tax = purchaseAmount * 0.06;
|
||||
System.out.println("Sales tax is " + (int)(tax * 100) / 100.0);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/lab4_1/DisplayTime.class
|
||||
com/calebfontenot/lab4_1/Lab4_1.class
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab4_1/src/main/java/com/calebfontenot/lab4_1/DisplayTime.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/Lab4_1/src/main/java/com/calebfontenot/lab4_1/Lab4_1.java
|
14
Assignments/LabClass_Sep6_CalebFontenot/pom.xml
Normal file
14
Assignments/LabClass_Sep6_CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.labclass_sep6_calebfontenot</groupId>
|
||||
<artifactId>LabClass_Sep6_CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.labclass_sep6_calebfontenot.LabClass_Sep6_CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.labclass_sep6_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ComputeTax {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create a Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Prompt the user to enter filing status
|
||||
System.out.print("(0-single filer, 1-married jointly or "
|
||||
+ "qualifying widow(er), 2-married separately, 3-head of "
|
||||
+ "household) Enter the filing status: ");
|
||||
|
||||
int status = input.nextInt();
|
||||
|
||||
// Prompt the user to enter taxable income
|
||||
System.out.print("Enter the taxable income: ");
|
||||
double income = input.nextDouble();
|
||||
|
||||
// Compute tax
|
||||
double tax = 0;
|
||||
|
||||
if (status == 0) { // Compute tax for single filers
|
||||
if (income <= 8350) {
|
||||
tax = income * 0.10;
|
||||
} else if (income <= 33950) {
|
||||
tax = 8350 * 0.10 + (income - 8350) * 0.15;
|
||||
} else if (income <= 82250) {
|
||||
tax = 8350 * 0.10 + (33950 - 8350) * 0.15
|
||||
+ (income - 33950) * 0.25;
|
||||
} else if (income <= 171550) {
|
||||
tax = 8350 * 0.10 + (33950 - 8350) * 0.15
|
||||
+ (82250 - 33950) * 0.25 + (income - 82250) * 0.28;
|
||||
} else if (income <= 372950) {
|
||||
tax = 8350 * 0.10 + (33950 - 8350) * 0.15
|
||||
+ (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28
|
||||
+ (income - 171550) * 0.33;
|
||||
} else {
|
||||
tax = 8350 * 0.10 + (33950 - 8350) * 0.15
|
||||
+ (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28
|
||||
+ (372950 - 171550) * 0.33 + (income - 372950) * 0.35;
|
||||
}
|
||||
} else if (status == 1) { // Compute tax for married file jointly
|
||||
// Left as exercise in Programming Exercise 3.13
|
||||
} else if (status == 2) { // Compute tax for married separately
|
||||
// Left as exercise in Programming Exercise 3.13
|
||||
} else if (status == 3) { // Compute tax for head of household
|
||||
// Left as exercise in Programming Exercise 3.13
|
||||
} else {
|
||||
System.out.println("Error: invalid status");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
// Display the result
|
||||
System.out.println("Tax is " + (int) (tax * 100) / 100.0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.labclass_sep6_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class LabClass_Sep6_CalebFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.labclass_sep6_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class SimpleIfDemo {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter an integer: ");
|
||||
int number = input.nextInt();
|
||||
|
||||
if (number % 5 == 0) {
|
||||
System.out.println("HiFive");
|
||||
}
|
||||
|
||||
if (number % 2 == 0) {
|
||||
System.out.println("HiEven");
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/labclass_sep6_calebfontenot/SimpleIfDemo.class
|
||||
com/calebfontenot/labclass_sep6_calebfontenot/LabClass_Sep6_CalebFontenot.class
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/SimpleIfDemo.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/LabClass_Sep6_CalebFontenot.java
|
14
Assignments/MP1/pom.xml
Normal file
14
Assignments/MP1/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.mp1</groupId>
|
||||
<artifactId>MP1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.mp1.MP1</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
17
Assignments/MP1/src/main/java/com/calebfontenot/mp1/MP1.java
Normal file
17
Assignments/MP1/src/main/java/com/calebfontenot/mp1/MP1.java
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.mp1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class MP1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
65
Assignments/MP1_CalebFontenot/HTML/CompoundValue.html
Normal file
65
Assignments/MP1_CalebFontenot/HTML/CompoundValue.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>CompoundValue.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.ST0 {color: #287bde}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/CompoundValue.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||||
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> CompoundValue {
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args) {
|
||||
<span class="comment">// Create Scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
|
||||
<span class="comment">// Define vars</span>
|
||||
<span class="literal">int</span> counter;
|
||||
<span class="literal">double</span> SavingAmount;
|
||||
<span class="literal">double</span> InterestRate;
|
||||
|
||||
<span class="comment">// Prompt for input</span>
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter monthly saving amount: </span><span class="string">"</span>);
|
||||
SavingAmount = input.nextDouble();
|
||||
|
||||
<span class="comment">// Compute and Print result</span>
|
||||
InterestRate = <span class="number">0.05</span> / <span class="number">12</span>;
|
||||
SavingAmount = SavingAmount * (<span class="number">1</span> + InterestRate);
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The account is </span><span class="string">"</span> + SavingAmount + <span class="string">"</span><span class="string"> after month 1</span><span class="string">"</span>);
|
||||
<span class="literal">for</span> (counter = <span class="number">2</span>; counter <= <span class="number">6</span>; counter++) {
|
||||
SavingAmount = (<span class="number">100</span> + SavingAmount) * (<span class="number">1</span> + InterestRate);
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The account is </span><span class="string">"</span> + SavingAmount + <span class="string">"</span><span class="string"> after month </span><span class="string">"</span> + counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
57
Assignments/MP1_CalebFontenot/HTML/Cylinder.html
Normal file
57
Assignments/MP1_CalebFontenot/HTML/Cylinder.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Cylinder.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/Cylinder.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> Cylinder {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
|
||||
{
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.in);
|
||||
|
||||
<span class="comment">// Enter radius of the cylinder</span>
|
||||
System.out.print(<span class="string">"</span><span class="string">Enter the radius and length of a cylinder: </span><span class="string">"</span>);
|
||||
<span class="literal">double</span> radius = input.nextDouble();
|
||||
<span class="literal">double</span> length = input.nextDouble();
|
||||
|
||||
<span class="comment">// Compute area and volume</span>
|
||||
<span class="literal">double</span> area = radius * radius * <span class="number">3.14159</span>;
|
||||
<span class="literal">double</span> volume = area * length;
|
||||
|
||||
<span class="comment">// Display result</span>
|
||||
System.out.println(<span class="string">"</span><span class="string">The area is </span><span class="string">"</span> + area);
|
||||
System.out.println(<span class="string">"</span><span class="string">The volume of the cylinder is </span><span class="string">"</span> + volume);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
93
Assignments/MP1_CalebFontenot/HTML/NumberOfYears.html
Normal file
93
Assignments/MP1_CalebFontenot/HTML/NumberOfYears.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>NumberOfYears.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.ST0 {color: #287bde}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/NumberOfYears.java</td></tr></table>
|
||||
<pre>
|
||||
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||||
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> NumberOfYears {
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
|
||||
{
|
||||
<span class="comment">// Define vars</span>
|
||||
<span class="literal">double</span> NumberOfMinutes;
|
||||
<span class="literal">double</span> NumberOfYears;
|
||||
<span class="literal">double</span> NumberOfDays;
|
||||
<span class="literal">double</span> NumberOfHours;
|
||||
|
||||
<span class="comment">// Create Scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
|
||||
<span class="comment">// Prompt for input</span>
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter the number of minutes: </span><span class="string">"</span>);
|
||||
NumberOfMinutes = input.nextDouble();
|
||||
|
||||
<span class="comment">// Calculate</span>
|
||||
NumberOfHours = (NumberOfMinutes / <span class="number">60</span>);
|
||||
NumberOfDays = (NumberOfHours / <span class="number">24</span>);
|
||||
NumberOfYears = (NumberOfDays / <span class="number">365</span>);
|
||||
|
||||
<span class="comment">// Big brain math time</span>
|
||||
<span class="comment">//Subtract 365 from "NumberOfDays" until the number is less than or equal to 365</span>
|
||||
<span class="literal">while</span> (NumberOfDays >= <span class="number">365.0</span>) {
|
||||
<span class="comment">//System.out.println("DEBUG: Subtracting 365 from "+ NumberOfDays);</span>
|
||||
NumberOfDays = NumberOfDays - <span class="number">365</span>;
|
||||
}
|
||||
|
||||
<span class="comment">// Do the same with hours</span>
|
||||
<span class="literal">while</span> (NumberOfHours >= <span class="number">24.0</span>) {
|
||||
<span class="comment">//System.out.println("DEBUG: Subtracting 24 from "+ NumberOfHours);</span>
|
||||
NumberOfHours = NumberOfHours - <span class="number">24</span>;
|
||||
}
|
||||
|
||||
<span class="comment">// Print output</span>
|
||||
System.<span class="ST3">out</span>.println((<span class="literal">int</span>) NumberOfMinutes + <span class="string">"</span><span class="string"> minutes is approx. :</span><span class="string">"</span>);
|
||||
<span class="literal">if</span> ((<span class="literal">int</span>)NumberOfYears >= <span class="number">2</span>) {
|
||||
System.<span class="ST3">out</span>.println((<span class="literal">int</span>) NumberOfYears + <span class="string">"</span><span class="string"> years,</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">if</span> ((<span class="literal">int</span>)NumberOfYears == <span class="number">1</span>) {
|
||||
System.<span class="ST3">out</span>.println((<span class="literal">int</span>)NumberOfYears+<span class="string">"</span><span class="string"> year.</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">if</span> ((<span class="literal">int</span>) NumberOfDays != <span class="number">0</span>) {
|
||||
System.<span class="ST3">out</span>.println((<span class="literal">int</span>) NumberOfDays + <span class="string">"</span><span class="string"> days,</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">if</span> ((<span class="literal">int</span>) NumberOfHours != <span class="number">0</span>) {
|
||||
System.<span class="ST3">out</span>.println((<span class="literal">int</span>) NumberOfHours + <span class="string">"</span><span class="string"> hours.</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
59
Assignments/MP1_CalebFontenot/HTML/SumOfDigits.html
Normal file
59
Assignments/MP1_CalebFontenot/HTML/SumOfDigits.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>SumOfDigits.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/SumOfDigits.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> SumOfDigits {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
|
||||
{
|
||||
java.util.Scanner input = <span class="literal">new</span> java.util.Scanner(System.in);
|
||||
<span class="comment">//> Read a number</span>
|
||||
System.out.print(<span class="string">"</span><span class="string">Inter an integer between 0 and 1000: </span><span class="string">"</span>);
|
||||
<span class="literal">int</span> number = input.nextInt();
|
||||
|
||||
<span class="comment">//> Find all digits in number</span>
|
||||
<span class="literal">int</span> lastDigit = number % <span class="number">10</span>;
|
||||
<span class="literal">int</span> remainingNumber = number / <span class="number">10</span>;
|
||||
<span class="literal">int</span> secondLastDigit = remainingNumber % <span class="number">10</span>;
|
||||
remainingNumber = remainingNumber / <span class="number">10</span>;
|
||||
<span class="literal">int</span> thirdLastDigit = remainingNumber % <span class="number">10</span>;
|
||||
|
||||
<span class="comment">//> Obtain the sum of all digits</span>
|
||||
<span class="literal">int</span> sum = lastDigit + secondLastDigit + thirdLastDigit;
|
||||
|
||||
<span class="comment">//>Display results</span>
|
||||
System.out.println(<span class="string">"</span><span class="string">The sum of all digits in </span><span class="string">"</span>+ number
|
||||
+ <span class="string">"</span><span class="string"> is </span><span class="string">"</span> + sum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
65
Assignments/MP1_CalebFontenot/HTML/Total.html
Normal file
65
Assignments/MP1_CalebFontenot/HTML/Total.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Total.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/Total.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> Total {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
|
||||
{
|
||||
<span class="comment">// Define variables:</span>
|
||||
<span class="literal">double</span> subtotal;
|
||||
<span class="literal">double</span> gratuity;
|
||||
<span class="literal">double</span> total;
|
||||
|
||||
<span class="comment">// Get subtotal and gratuity rate</span>
|
||||
<span class="comment">// Setup Scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.in);
|
||||
|
||||
<span class="comment">// Get vars</span>
|
||||
System.out.print(<span class="string">"</span><span class="string">Enter subtotal and gratuity rate: </span><span class="string">"</span>);
|
||||
subtotal = input.nextDouble();
|
||||
gratuity = input.nextDouble();
|
||||
|
||||
<span class="comment">// Calculate</span>
|
||||
<span class="comment">// Convert gratuity into a decimal because its a percentage:</span>
|
||||
gratuity = (gratuity / <span class="number">10</span>); <span class="comment">//* 10;</span>
|
||||
|
||||
total = (subtotal + gratuity);
|
||||
|
||||
<span class="comment">// Print result</span>
|
||||
System.out.println(<span class="string">"</span><span class="string">The gratuity is $</span><span class="string">"</span>+gratuity+<span class="string">"</span><span class="string"> and the total is $</span><span class="string">"</span>+total);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
58
Assignments/MP1_CalebFontenot/HTML/WindChill.html
Normal file
58
Assignments/MP1_CalebFontenot/HTML/WindChill.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>WindChill.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/WindChill.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
|
||||
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> WindChill {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args) {
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.in);
|
||||
<span class="comment">//> Enter the new temperature in Fahrenheit</span>
|
||||
System.out.print(<span class="string">"</span><span class="string">Enter the temperature in Fahrenheit between -58∞F and 41∞F: </span><span class="string">"</span>);
|
||||
<span class="literal">double</span> fahrenheit = input.nextDouble();
|
||||
|
||||
<span class="comment">//> Enter the wind speed miles per hour</span>
|
||||
System.out.print(<span class="string">"</span><span class="string">Enter the wind speed miles per hour </span><span class="string">"</span>+
|
||||
<span class="string">"</span><span class="string">(must be greater or equal to 2):</span><span class="string">"</span>);
|
||||
<span class="literal">double</span> speed = input.nextDouble();
|
||||
|
||||
<span class="comment">//> Compute wind and chill index</span>
|
||||
<span class="literal">double</span> windChillIndex = <span class="number">35.74</span> + <span class="number">0.6215</span> * fahrenheit - <span class="number">35.75</span>
|
||||
* Math.pow(speed, <span class="number">0.16</span>) + <span class="number">0.4275</span> * fahrenheit
|
||||
* Math.pow(speed, <span class="number">0.16</span>);
|
||||
|
||||
<span class="comment">//> Display the result</span>
|
||||
System.out.println(<span class="string">"</span><span class="string">The wind chill index is </span><span class="string">"</span>+ windChillIndex);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
BIN
Assignments/MP1_CalebFontenot/mp1-f22.pdf
Normal file
BIN
Assignments/MP1_CalebFontenot/mp1-f22.pdf
Normal file
Binary file not shown.
14
Assignments/MP1_CalebFontenot/pom.xml
Normal file
14
Assignments/MP1_CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot.mp1_calebfontenot</groupId>
|
||||
<artifactId>MP1_CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.mp1_calebfontenot.MP1_CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class CompoundValue {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Create Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Define vars
|
||||
int counter;
|
||||
double SavingAmount;
|
||||
double InterestRate;
|
||||
|
||||
// Prompt for input
|
||||
System.out.print("Enter monthly saving amount: ");
|
||||
SavingAmount = input.nextDouble();
|
||||
|
||||
// Compute and Print result
|
||||
InterestRate = 0.05 / 12;
|
||||
SavingAmount = SavingAmount * (1 + InterestRate);
|
||||
System.out.println("The account is " + SavingAmount + " after month 1");
|
||||
for (counter = 2; counter <= 6; counter++) {
|
||||
SavingAmount = (100 + SavingAmount) * (1 + InterestRate);
|
||||
System.out.println("The account is " + SavingAmount + " after month " + counter);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Cylinder {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Enter radius of the cylinder
|
||||
System.out.print("Enter the radius and length of a cylinder: ");
|
||||
double radius = input.nextDouble();
|
||||
double length = input.nextDouble();
|
||||
|
||||
// Compute area and volume
|
||||
double area = radius * radius * 3.14159;
|
||||
double volume = area * length;
|
||||
|
||||
// Display result
|
||||
System.out.println("The area is " + area);
|
||||
System.out.println("The volume of the cylinder is " + volume);
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class MP1_CalebFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class NumberOfYears {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Define vars
|
||||
double NumberOfMinutes;
|
||||
double NumberOfYears;
|
||||
double NumberOfDays;
|
||||
double NumberOfHours;
|
||||
|
||||
// Create Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Prompt for input
|
||||
System.out.print("Enter the number of minutes: ");
|
||||
NumberOfMinutes = input.nextDouble();
|
||||
|
||||
// Calculate
|
||||
NumberOfHours = (NumberOfMinutes / 60);
|
||||
NumberOfDays = (NumberOfHours / 24);
|
||||
NumberOfYears = (NumberOfDays / 365);
|
||||
|
||||
// Big brain math time
|
||||
//Subtract 365 from "NumberOfDays" until the number is less than or equal to 365
|
||||
while (NumberOfDays >= 365.0) {
|
||||
//System.out.println("DEBUG: Subtracting 365 from "+ NumberOfDays);
|
||||
NumberOfDays = NumberOfDays - 365;
|
||||
}
|
||||
|
||||
// Do the same with hours
|
||||
while (NumberOfHours >= 24.0) {
|
||||
//System.out.println("DEBUG: Subtracting 24 from "+ NumberOfHours);
|
||||
NumberOfHours = NumberOfHours - 24;
|
||||
}
|
||||
|
||||
// Print output
|
||||
System.out.println((int) NumberOfMinutes + " minutes is approx. :");
|
||||
if ((int)NumberOfYears >= 2) {
|
||||
System.out.println((int) NumberOfYears + " years,");
|
||||
}
|
||||
if ((int)NumberOfYears == 1) {
|
||||
System.out.println((int)NumberOfYears+" year.");
|
||||
}
|
||||
if ((int) NumberOfDays != 0) {
|
||||
System.out.println((int) NumberOfDays + " days,");
|
||||
}
|
||||
if ((int) NumberOfHours != 0) {
|
||||
System.out.println((int) NumberOfHours + " hours.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class SumOfDigits {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
java.util.Scanner input = new java.util.Scanner(System.in);
|
||||
//> Read a number
|
||||
System.out.print("Inter an integer between 0 and 1000: ");
|
||||
int number = input.nextInt();
|
||||
|
||||
//> Find all digits in number
|
||||
int lastDigit = number % 10;
|
||||
int remainingNumber = number / 10;
|
||||
int secondLastDigit = remainingNumber % 10;
|
||||
remainingNumber = remainingNumber / 10;
|
||||
int thirdLastDigit = remainingNumber % 10;
|
||||
|
||||
//> Obtain the sum of all digits
|
||||
int sum = lastDigit + secondLastDigit + thirdLastDigit;
|
||||
|
||||
//>Display results
|
||||
System.out.println("The sum of all digits in "+ number
|
||||
+ " is " + sum);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Total {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Define variables:
|
||||
double subtotal;
|
||||
double gratuity;
|
||||
double total;
|
||||
|
||||
// Get subtotal and gratuity rate
|
||||
// Setup Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Get vars
|
||||
System.out.print("Enter subtotal and gratuity rate: ");
|
||||
subtotal = input.nextDouble();
|
||||
gratuity = input.nextDouble();
|
||||
|
||||
// Calculate
|
||||
// Convert gratuity into a decimal because its a percentage:
|
||||
gratuity = (gratuity / 10); //* 10;
|
||||
|
||||
total = (subtotal + gratuity);
|
||||
|
||||
// Print result
|
||||
System.out.println("The gratuity is $"+gratuity+" and the total is $"+total);
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.mp1_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class WindChill {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
//> Enter the new temperature in Fahrenheit
|
||||
System.out.print("Enter the temperature in Fahrenheit between -58∞F and 41∞F: ");
|
||||
double fahrenheit = input.nextDouble();
|
||||
|
||||
//> Enter the wind speed miles per hour
|
||||
System.out.print("Enter the wind speed miles per hour "+
|
||||
"(must be greater or equal to 2):");
|
||||
double speed = input.nextDouble();
|
||||
|
||||
//> Compute wind and chill index
|
||||
double windChillIndex = 35.74 + 0.6215 * fahrenheit - 35.75
|
||||
* Math.pow(speed, 0.16) + 0.4275 * fahrenheit
|
||||
* Math.pow(speed, 0.16);
|
||||
|
||||
//> Display the result
|
||||
System.out.println("The wind chill index is "+ windChillIndex);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.class
|
||||
com/calebfontenot/mp1_calebfontenot/Cylinder.class
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user