ASDV-Java/MP1_CalebFontenot/HTML/Total.html

66 lines
3.0 KiB
HTML

2022-08-28 17:39:39 +07:00
<!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">&quot;</span><span class="string">Enter subtotal and gratuity rate: </span><span class="string">&quot;</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">&quot;</span><span class="string">The gratuity is $</span><span class="string">&quot;</span>+gratuity+<span class="string">&quot;</span><span class="string"> and the total is $</span><span class="string">&quot;</span>+total);
}
}
</pre></body>
</html>