Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java language in jGRASP only please B01 - Automatic Learning Write a program in a java file called ArtificialIntelligence.java. Context: You have a target random

Java language in jGRASP only please

B01 - Automatic Learning Write a program in a java file called ArtificialIntelligence.java. Context: You have a target random number between 0 and 10. Your program represents a model that generates random numbers between 0 and rangeMax trying to predict a number close to the target one. When the program predicts a random number between 0 and rangeMax, it will compute the absolute difference between the current output and the target number. If the difference is greater than 10, then your program will update its rangeMax variable to decrease it by 10. Do this until the difference is not greater than 10, in that case we consider the model is accurate enough. Your program will do the following: 1. Initialize a rangeMax variable to 100. 2. Call a function named generateGroundTruthData, that will compute and return a random number between 0 and 10. 3. Back in the main method, the value returned by the generateGroundTruthData method will be the target number. 4. Your program will continuously call the method train, which: 4.1. Computes a random number between 0 and the current rangeMax value. 4.2. Computes the absolute difference between the current predicted number and the target number. 4.3. Return the new value for the rangeMax. If the difference is greater than 10, then currentMax - 10. Otherwise, the new value is the same as the current value. 5. Back in the main method, update the rangeMax value with the new value returned by the train method and print this value. 6. If the value hasn't changed, then finish the program and print "The model has finished learning." B02 - Hashing a function Write a program in a java file called Hash.java. A hash function maps data of a variable length size to data of a fixed size. In this case, your program will first call a method askUserInput that will print the message "Please, enter your message:" and ask for the user input. This method will return the user input back to the main method. Then, your program will call a method processDigits that will iterate through all the characters in the user input message and return the sum of all the digits contained in the user message. This method will return the result back to the main method. Then, your program will call a method named processTextMessage. This method will return the number of characters in the text that are not number digits. Finally, your program will call a method printHash, that will receive the sum of all digits in the message and the count of characters that are not digits, and it will print the hash, which will be computed as the string concatenation of both numbers, in the previous order. B03 - Two-Step Authentication Write a program in a java file called Authentication.java. Your program will call two methods, one that asks the user for the username and returns this value, and another method to ask the user for the password and returns this value. Then, your program will call the method validateCredentials that will check if the username equals "myusername" and password equals "pass123". If the result is false, your program will print "Invalid username or password". Otherwise, your method will print "Log in successful". This method will return whether the login was successful or not. Back in your main method, your program will keep asking the user for the credentials and checking with the expected ones until the user enters the correct username and password. B04 - Academic admission system Write a program in a java file called Admissions.java You will write a program that will either accept or deny graduate admissions based on the grades obtained in the undergraduate program. The conversion from letter grades to GPA points is the following: LETTER GRADE GPA points A+ 4.3 A 4.0 A- 3.7 B+ 3.3 B 3.0 B- 2.7 C+ 2.3 C 2.0 C- 1.7 D+ 1.3 D 1.0 D- 0.7 F 0.0 Your program will call a method askUserGrade, that asks the user for the letter grade obtained in an undergraduate course and returns the corresponding GPA points. In order for the user to finish entering grades, the user will enter "EXIT" and your program will return -1. Back in the main method, your program will accumulate the GPA points and count the number of grades entered by the user. When the user enters EXIT, then your program stop asking for more grades. When the program stops asking for grades, it will call a method named computeAverageGPA that, based on the accumulated points and the number of grades entered, will compute and return the average GPA points. Then, your program will call a method named askForProgram, where the user will enter either "masters" or "phd", but in any combination of lowercase and uppercase letter. Your method will return the user input. Back in the main method, your program will call the processApplication, where the program will decide whether or not the application is accepted depending on the average GPA, the program the user is applying to and the following rules. Your method will print the final decision: - If the user is applying to the Masters program, then he/she needs a GPA above 3.0 - If the user is applying to the PhD program, then he/she needs a GPA above 3.5 NOTE: The user can enter any combination of uppercase and lowercase letters for "masters" or "phd". You can assume users will always enter any of these two values. That is, the user can enter "Masters", "MASTERS", "masters", "MaStErS", "PHD", "phd", "PhD", etc. but not "doctorate", "bachelors", etc.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago