ASDV-Java/Exams/Exam1Practice_CalebFontenot/RandomMonth.html

72 lines
5.4 KiB
HTML
Executable File

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>RandomMonth.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #000000; background-color: #ffffff; font-family: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST4 {font-family: monospace; font-style: italic}
.ST5 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.string {color: #1e9347}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\RandomMonth.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.exam1_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">RandomMonth</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
<span class="literal">int</span> number = (<span class="literal">int</span>) (Math.<span class="ST4">random</span>() * 12 + 1);
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Random generated number is: </span><span class="string">&quot;</span> + number);
<span class="literal">switch</span> (number) {
<span class="literal">case</span> 1:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is January</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 2:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is February</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 3:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is March</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 4:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is April</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 5:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is May</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 6:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is June</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 7:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is July</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 8:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is August</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 9:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is September</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 10:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is October</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 11:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is November</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 12:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is December</span><span class="string">&quot;</span>); <span class="literal">break</span>;
}
}
}
</pre></body>
</html>