Reset author name to chosen name ✨
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.exam1_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ar114
|
||||
*/
|
||||
public class DayOfTheWeek {
|
||||
public static void main(String[] args) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("\n\n Enter year (e.g. 2008): ");
|
||||
int year = input.nextInt();
|
||||
System.out.print("Enter month 1-12: ");
|
||||
int month = input.nextInt();
|
||||
if (month == 1) {
|
||||
month = 13;
|
||||
year = year - 1;
|
||||
}
|
||||
else if (month == 2) {
|
||||
month = 14;
|
||||
year = year - 1;
|
||||
}
|
||||
System.out.println("Enter the day of the month: 1-31: ");
|
||||
int dayOfMonth = input.nextInt();
|
||||
|
||||
int j = year / 100;
|
||||
int k = year % 100;
|
||||
|
||||
int dayOfWeek = (dayOfMonth
|
||||
+ 26 * (month + 1) / 10 + k + k / 4 + j / 4 + 5 * j) % 7;
|
||||
if (dayOfWeek == 0) {
|
||||
System.out.println("Day of the week is Saturday");
|
||||
}
|
||||
else if (dayOfWeek == 1) {
|
||||
System.out.println("Day of the week is Sunday");
|
||||
}
|
||||
else if (dayOfWeek == 2) {
|
||||
System.out.println("Day of the week is Monday");
|
||||
}
|
||||
else if (dayOfWeek == 3) {
|
||||
System.out.println("Day of the week is Tuesday");
|
||||
}
|
||||
else if (dayOfWeek == 4) {
|
||||
System.out.println("Day of the week is Wednesday");
|
||||
}
|
||||
else if (dayOfWeek == 5) {
|
||||
System.out.println("Day of the week is Thursday");
|
||||
}
|
||||
else if (dayOfWeek == 6) {
|
||||
System.out.println("Day of the week is Friday");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.exam1_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ar114
|
||||
*/
|
||||
public class Exam1_ChloeFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.exam1_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ar114
|
||||
*/
|
||||
public class RandomMonth {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int number = (int) (Math.random() * 12 + 1);
|
||||
System.out.println("Random generated number is: " + number);
|
||||
switch (number) {
|
||||
case 1:
|
||||
System.out.println("Month is January"); break;
|
||||
case 2:
|
||||
System.out.println("Month is February"); break;
|
||||
case 3:
|
||||
System.out.println("Month is March"); break;
|
||||
case 4:
|
||||
System.out.println("Month is April"); break;
|
||||
case 5:
|
||||
System.out.println("Month is May"); break;
|
||||
case 6:
|
||||
System.out.println("Month is June"); break;
|
||||
case 7:
|
||||
System.out.println("Month is July"); break;
|
||||
case 8:
|
||||
System.out.println("Month is August"); break;
|
||||
case 9:
|
||||
System.out.println("Month is September"); break;
|
||||
case 10:
|
||||
System.out.println("Month is October"); break;
|
||||
case 11:
|
||||
System.out.println("Month is November"); break;
|
||||
case 12:
|
||||
System.out.println("Month is December"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.chloefontenot.exam1_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ar114
|
||||
*/
|
||||
public class TrianglePerimeter {
|
||||
public static void main(String[] args) {
|
||||
// Create scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Define variables
|
||||
int triEdge1, triEdge2, triEdge3;
|
||||
|
||||
// Prompt for input
|
||||
System.out.print("Enter 3 edges for a triangle: ");
|
||||
triEdge1 = input.nextInt();
|
||||
triEdge2 = input.nextInt();
|
||||
triEdge3 = input.nextInt();
|
||||
|
||||
// Compute and print output
|
||||
System.out.println(((triEdge1 + triEdge2) > triEdge3) ||
|
||||
((triEdge1 + triEdge3) > triEdge2) ||
|
||||
((triEdge2 + triEdge3) > triEdge1) ?
|
||||
"Input is valid" : "Invalid Input");
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user