Reset author name to chosen name ✨
This commit is contained in:
@@ -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.lab5_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Lab5_ChloeFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
@@ -1,48 +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.lab5_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Operators {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int x = 8; int y = 15; double d = 2;
|
||||
|
||||
//1. Increment x by 2;
|
||||
//add code here
|
||||
x += 2;
|
||||
|
||||
//2. Increment y by 5 using the += operator
|
||||
//add code here
|
||||
y += 5;
|
||||
|
||||
//3. Increment d by 1 using the ++ operator
|
||||
//add code here
|
||||
d++;
|
||||
|
||||
//4. Modify the expression below to print z1 = 1.5 and not 0.0
|
||||
double z1 = ((double) x /(double) y ) * d++;
|
||||
System.out.println("z1: " + z1 );
|
||||
|
||||
//5. Modify the expresion below the print z2 = 2.5 and not 0.0
|
||||
double z2 = ((double) x /(double) y ) * ++d;
|
||||
System.out.println("z2: " + z2 );
|
||||
|
||||
/* 6. Declare a variable z3 of type double and modify the
|
||||
right hand side of the expression you built in step 5 for the
|
||||
expression to evaluate 2.0.
|
||||
Assign the evaluation to varible z3
|
||||
*/
|
||||
double z3 = ((double) x /(double) y * (d - 1));
|
||||
//add code here
|
||||
System.out.println("z3: "+ z3 );
|
||||
|
||||
System.out.println("x=" + x + " y=" + y + " d=" + d +
|
||||
" z1="+ z1 + " z2=" +z2 + " z3=" +z3);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +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.lab5_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Swap {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Define vars
|
||||
double base,
|
||||
power,
|
||||
output;
|
||||
|
||||
// Prompt for input
|
||||
System.out.println("Enter the base to calculate: ");
|
||||
base = input.nextDouble();
|
||||
System.out.println("Enter the power to calculate: ");
|
||||
power = input.nextDouble();
|
||||
|
||||
// Calculate
|
||||
output = Math.pow(base, power);
|
||||
|
||||
// Print result
|
||||
System.out.println(base+"^"+power+" = "+ output);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +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.lab5_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class WhatsYourName {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Declare vars
|
||||
String firstName,
|
||||
lastName;
|
||||
|
||||
// Prompt for input
|
||||
System.out.print("What's your name? (Enter first and last) ");
|
||||
firstName = input.next();
|
||||
lastName = input.next();
|
||||
|
||||
// Print output
|
||||
System.out.println(firstName + " " + lastName + " is a beautiful name!");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +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.lab5_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class WhatsYourSSN {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create Scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Declare vars
|
||||
String ssn;
|
||||
|
||||
// Prompt for input
|
||||
System.out.print("What's your SSN? ");
|
||||
ssn = input.next();
|
||||
|
||||
// Print output
|
||||
System.out.println(ssn + " is your SSN.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user