Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

In this assignment, you will write a recursive method.This is yet another version of Assignment 1. You may use your own solution, or use the one provided under Week 1. You are to re-write...

1 answer below »
In this assignment, you will write a recursive method.This is yet another version of Assignment 1. You may use your own solution, or use the one provided under Week 1. You are to re-write theisCorrectmethod so that it isrecursive. The code will not be long but there will be a lot of planning and thinking that should come before coding. The first thing you need to remember is that there should be no loop in this method anymore. The loop is replaced by recursive calls to itself. Think of its base case(s) and what/how recursion can be worked in.No credit shall be given if yourisCorrectmethod is not recursive.There is no change to the user interface of your code. From the user's perspective, the program is the same. However, yourisCorrectmust be implemented using recursion. Be sure to focus on the correctness of yourisCorrectmethod in your video.Comments:
  • Add Javadoc to each class, and each method. Each class must have, at the least, a purpose, @author, @version (date). Each method must have, at the least, a purpose, @param(s) as needed, and @return if needed.
  • Add inline or block comments and non-trivial parts of your code.
Answered 2 days After Aug 04, 2021

Solution

Kshitij answered on Aug 07 2021
146 Votes
Assignment1MainWeek5.java
Assignment1MainWeek5.java
*   Created by IntelliJ IDEA.
 *   Author: Kshitij Varshney (kshitijvarshne1)
 *   Date: 06-Aug-21
 *   Time: 11:39 AM
 *   File: Assignment1MainWeek5.java
 *
package August.aug06_21;
import java.util.Random;
import java.util.Scanner;
**
 * @author CPR 
 StiglianoS
 * @version July282021
 *
public class Assignment1MainWeek5 {
    public static void main(String[] args) {
        int actual_PIN, encoded_PIN;
        Random rand = new Random();
        Scanner scan = new Scanner(System.in);
        Password pw;
        System.out.print("Enter the actual PIN: ");
        actual_PIN = scan.nextInt();
        while (actual_PIN != -1) {
            pw = new Password(rand.nextInt(6) + 3);
            System.out.println("Actual PIN = " + actual_PIN + "; " + pw);
            
ask user for the encoded PIN
            System.out.print("Please enter your encoded PIN : ");
            encoded_PIN = scan.nextInt();
            
check whether the en...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here