Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use a back-end software component written in Java that meets the following criteria: use the customer's and purchase information to approve or send an item

Use a back-end software component written in Java that meets the following criteria:

use the customer's and purchase information to approve or send an item for warranty or Maintenace repair. 

  • Receives and processes user data, uses data types, design, and style.
  • Executes back-end code. Contains a decision structure, an iterative structure, and a user designed function.
  • Document the code and explain what it is accomplishing and how.

 

Submission Requirement:

  1. A screenshot of the GUI
  2. The documented back-end code that contains:
  3. a decision structure, if else statement
  4. an iterative structure, like a loop
  5. a user defined function, validation for an error on the input data 
  6. functionality to receive and process user input data from the front-end GUI
  7. help make the code below better.

import java.util.Scanner;

public class WarrantyMaintenance {

 // User-defined function for validating user input
 public static boolean validateInput(String input) {
   if (input == null || input.trim().isEmpty()) {
     return false;
   }
   return true;
 }

 public static void main(String[] args) {
   Scanner scanner = new Scanner(System.in);

   // input of user data
   System.out.println("Please enter your name: ");
   String name = scanner.nextLine();

   System.out.println("Please enter your email address: ");
   String email = scanner.nextLine();

   System.out.println("Please enter the date of purchase (MM/DD/YYYY): ");
   String purchaseDate = scanner.nextLine();

   System.out.println("Please enter the warranty period in months: ");
   int warrantyPeriod = scanner.nextInt();

   // Executes the back-end code
   boolean isValidInput = validateInput(name) && validateInput(email) && validateInput(purchaseDate);
   if (isValidInput) {
     System.out.println("Thank you for submitting the warranty information.");
     System.out.println("We will send you a confirmation email a soon as posible.");

     // Iterative structure the for loop
     for (int i = 1; i <= warrantyPeriod; i++) {
       System.out.println("Your warranty is good or valid for " + i + " months.");
     }
   } else {
     // Decision structure for the if-else statement
     System.out.println("Invalid input or data; please try again.");
   }
 }


Step by Step Solution

3.42 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

The provided code is a Java program for processing warranty information based on user input It collects user data validates it and then either proceed... 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

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

Create a Fishbone diagram with the problem being coal "mine safety

Answered: 1 week ago

Question

Quadrilateral EFGH is a kite. Find mG. E H Answered: 1 week ago

Answered: 1 week ago