CSU Banner

CS 163/164, Spring 2019

Programming Assignment - P2

Strange Formulas

Due Monday, Feb. 4th at 6:00pm

Late - Tuesday, Feb. 5th at 8:00am


Objectives of this Assignment

  1. To write a Java program to implement formulas,
  2. to learn how to read input from the user via the console,
  3. to declare variables and use them in expressions, and
  4. to learn about printing formatted output to the console.
  5. to learn that you can implement a formula that you are not familiar with.

Instructions

Write a Java program file called P2.java with a class name P2, an example of the code is shown below. All of the Java code you write should be contained in the main method. For this assignment, you must follow the directions below exactly:

Program Structure

// P2 Assignment Solution
// Author: Ms. White
// Date:   8/27/2018
// Class:  CS163/164
// Email:  white@colostate.edu

import java.util.Scanner;

public class P2 {

    public static void main(String[] args) {

        // Declare variables for mysterious formulas

        // Instantiate scanner
        Scanner keyboard = new Scanner(System.in);

        // Prompt and read alphaAcid from keyboard
        
        // Prompt and read ounces from keyboard
        
        // Calculate HBUs

        // Print HBUs to console

        // Prompt and read remaining variables
        
        // Compute the SRM value using the formula
        
        // Print SRM to console

        // Close scanner
        keyboard.close();
    }
}

Sample Output

Your program should print 7 lines, as below. The user input is shown in blue.

Alpha Acid? 5.0
Ounces? 2.0
The HBUs are 10.00.
Weight? 1.0
Lovibond? 80.0
Volume? 5.0
The SRM value is 9.5000.

Specifications

Grading Criteria


Submit P2.java to Checkin.


CS Banner
CS Building