Question
1. Write a for loop that will write the decimal equivalents to all fractions in the range 1/2, 1/3, 1/4,...1/25. There are no methods needed
1. Write a for loop that will write the decimal equivalents to all fractions in the range 1/2, 1/3, 1/4,...1/25. There are no methods needed for this outside of main(). There is no user input for this assignment. Display these fractions to 5 decimal places.
2.
Write a program to read a list of test scores given as floating point percentages in the range 0.0 to 100.0. You will not be using a data structure to store these data items. You will not be using a data class to store these data items. You may write the processing for this in the main() method. You may use the technique of assigning highest and lowest grades to literals as demonstrated in today's class .
Determine and display
- the total number of A's (90 - 100), B's (80 - 89), C's (70 - 79), D's (60 - 69) and F's (59 and below)
- the total number of grades (you will need a counter!)
- the overall average grade
- the lowest grade
- the highest grade
use this data file: grades.txt
For example if the input is :
22 55 66 77 88 100 34 98
The output would be
Total number of grades : 8
Number of A's : 2
Number of B's: 1
Number of C's : 1
Number of D's : 1
Number of F's : 3
Overall average grade : 67.50
Lowest grade : 22
Highest grade : 100
Knowing what you know about random numbers from above and two methods of the String class, charAt() and length(), generate 10 random characters from this string: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()
HINTS: How many characters are in the above string? How do you generate a random number in the range of indices in the above string? How do you make your code return a character at a random position? where is 'A'?
Remember if you can get one random character, you can generate all 10.
A sample run of this program might look like:
$%FreTQ&6z
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started