Init
This commit is contained in:
14
MP1_CalebFontenot/pom.xml
Normal file
14
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,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,41 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
// Print output
|
||||
System.out.println((int) NumberOfMinutes+" minutes is approx. :");
|
||||
System.out.println((int) NumberOfHours+" hours,");
|
||||
System.out.println((int) NumberOfDays+" days,");
|
||||
System.out.println((int) NumberOfYears+" years.");
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
||||
}
|
||||
}
|
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
|
@@ -0,0 +1,2 @@
|
||||
/home/caleb/NetBeansProjects/ADSV Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/Cylinder.java
|
||||
/home/caleb/NetBeansProjects/ADSV Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/MP1_CalebFontenot.java
|
Reference in New Issue
Block a user