HTML go brrrrrr
This commit is contained in:
parent
1ab026d1cd
commit
fc117cd0f9
BIN
MP1_CalebFontenot.zip
Normal file
BIN
MP1_CalebFontenot.zip
Normal file
Binary file not shown.
65
MP1_CalebFontenot/HTML/CompoundValue.html
Normal file
65
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
MP1_CalebFontenot/HTML/Cylinder.html
Normal file
57
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
MP1_CalebFontenot/HTML/NumberOfYears.html
Normal file
93
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
MP1_CalebFontenot/HTML/SumOfDigits.html
Normal file
59
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
MP1_CalebFontenot/HTML/Total.html
Normal file
65
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
MP1_CalebFontenot/HTML/WindChill.html
Normal file
58
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>
|
Loading…
x
Reference in New Issue
Block a user