Reset author name to chosen name ✨
This commit is contained in:
@@ -1,42 +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.lab3_1_chloefontenot;
|
||||
import java.util.Scanner;
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Lab3 {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Create a scanner object
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
// Prompt for hight in feet
|
||||
System.out.print("Enter the height (feet): ");
|
||||
double height;
|
||||
height = input.nextDouble();
|
||||
|
||||
// Prompt for width in feet
|
||||
System.out.print("Enter the width (feet):");
|
||||
double width;
|
||||
width = input.nextDouble();
|
||||
|
||||
// Calculate the area
|
||||
double area;
|
||||
area = height * width;
|
||||
// Print area calculated
|
||||
System.out.println("Calculated area is "+area);
|
||||
//create constants
|
||||
final double GALLONS_PER_SQUARE_FEET = 150.0;
|
||||
|
||||
// calculate the gallons
|
||||
double gallons;
|
||||
gallons = area/GALLONS_PER_SQUARE_FEET;
|
||||
//calculate the number of gallons needed to paint the wall
|
||||
System.out.println("The amount of paint is " + gallons +" gallons.");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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.lab3_1_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class MilesToKilometers {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
double miles;
|
||||
double km;
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
//> 1. Prompt the user to enter the number of miles
|
||||
System.out.println("Please enter miles to convert into kilometers");
|
||||
//> 2. Read the miles and store it into a variable
|
||||
miles = scanner.nextDouble();
|
||||
//> 3. Calculate the KM from the entered miles
|
||||
km = miles * 1.67;
|
||||
//> 4. Display the result
|
||||
System.out.println("You entered "+miles+" miles which is "+km+" kilometers");
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.chloefontenot.lab3_1_chloefontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class RunwayLength {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
//Define data objects
|
||||
double length;
|
||||
double acceleration;
|
||||
double velocity;
|
||||
|
||||
//Create scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
//Prompt for input
|
||||
System.out.print("Enter velocity: ");
|
||||
velocity = input.nextDouble();
|
||||
System.out.print("Enter acceleration: ");
|
||||
acceleration = input.nextDouble();
|
||||
|
||||
//Calculate
|
||||
length = Math.pow(velocity, 2) / (2 * acceleration);
|
||||
|
||||
//Print calculation
|
||||
System.out.println("The minimum runway length for this airplane is "+length);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user