Java Assignment: Least Change Assignment, Assignments of Java Programming

A programming assignment that involves creating a design tool, structuring a program, generating random numbers, and using basic decision statements and loops. The task is to write a program that generates a random number between 0 and 99, which represents the amount of change from a money transaction. Based on the random number, the program should determine the least possible coins to make change. examples and rules for the program, and requires the submission of 5 different random change transactions.

Typology: Assignments

2021/2022

Available from 04/25/2023

alaminenquaries
alaminenquaries 🇧🇩

9 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Java Assignment: Least Change Assignment
Competencies:
Creating a design tool
Structuring a program
Random Number Generation
Basic decision statement
Basic loop
Variables
Specifications:
You are to design, write, test and submit a solution for the following:
Write a short program that will generate a random number between 0 and 99. The
random number will represent the amount of coin (change) from a money transaction.
Based on the random number, you are to determine the least possible coins to make
change.
For example:
Total change = 82
Half Dollar …….. 1
Quarter ……..…. 1
Nickel ….……… 1
Pennies………. 2
For example:
Total change = 22
Dimes ….…….. 2
Pennies………. 2
For example:
Total change = 76
Half Dollar …….. 1
pf3
pf4

Partial preview of the text

Download Java Assignment: Least Change Assignment and more Assignments Java Programming in PDF only on Docsity!

Java Assignment: Least Change Assignment Competencies:  Creating a design tool  Structuring a program  Random Number Generation  Basic decision statement  Basic loop  Variables Specifications: You are to design, write, test and submit a solution for the following: Write a short program that will generate a random number between 0 and 99. The random number will represent the amount of coin (change) from a money transaction. Based on the random number, you are to determine the least possible coins to make change. For example: Total change = 82 Half Dollar …….. 1 Quarter ……..…. 1 Nickel ….……… 1 Pennies………. 2 For example: Total change = 22 Dimes ….…….. 2 Pennies………. 2 For example: Total change = 76 Half Dollar …….. 1

Quarter ……..…. 1 Penny………….. 1 Other rules:  If there are no coin type then it does not appear.  If there is one of a coin type then the word is singular  If there is more than one of a coin type then the word is plural  You are to have your program produce 5 different random change transactions. Note: comments within your source code is not a design tool. You are to attach your *.java source code. Forbidden  NEVER use global variables or NEVER use goto.

System.out.println(nickels + " Nickel" + ((nickels > 1)? "s" : "")); } if (pennies > 0) { System.out.println(pennies + " Penny" + ((pennies > 1)? "s" : "")); } System.out.println(); } } }