Question

In: Computer Science

JAVA PROJECT USING NETBEANS An application that keeps a record of family profiles in a city...

JAVA PROJECT USING NETBEANS

An application that keeps a record of family profiles in a city that are qualified in the program. Only one member of the family is allowed to apply for the SAP ( is a program/Organization)  and that is the head of the family. Qualified families are those that belong to the poorest of the poor whose total daily earning is 550 or below per day. (Assume that the income is the only qualification. In reality there are more like senior citizens, indigent people, disabled persons, etc.)

Minimum Requirement:

The application/ program  must be able to do the ff:

• process an application for the program which is the SAP. Make sure that the applicant is qualified and that there was no prior application made by any member of his family.

(OPTIONAL if you can only do this part) • generate a sorted list of all SAP (is a program/organization) beneficiaries in the city.

(OPTIONAL if you can only do this part) • generate a sorted list of SAP (is a program/organization) beneficiaries per family size.

(OPTIONAL if you can only do this part) • count the number of beneficiaries that earn less than 100 per day.

Solutions

Expert Solution

Hi,

It was long task to complete so i did what was possible in the gien timeframe.

1. Complted the reqgistration of SAP members

2. Count the total number of beneficiaries earn less than 100

I created total system which is based on user choices...user can register or can do other operations.

Choice number 1 and 4 and 5 are done in this program.

import java.util.ArrayList;
import java.util.Scanner;


public class SAPApplications {

        public static void main(String[] args) 
        {
                ArrayList<FamilyMember> memList = new ArrayList<FamilyMember>();
        Scanner choice = new Scanner(System.in);
        String input="";
                 System.out.println("############ Welcome To The SAP Member Registration System ############\n\n");
                ///// start while loop////////////
                while(true){
                        System.out.println("########## Please choose below options: #############\n");
            //user can  choose below options 
                    System.out.println("1. To new member registration.");
                    System.out.println("2. Display list of beneficiaries in the city.");
                        System.out.println("3. Display beneficiaries family size.");
                        System.out.println("4. Display number of beneficiaries that earn less than 100 per day.");
            System.out.println("5. Quit.");

                        input = choice.nextLine();
                        // by this we are displaying studdent information
                        if(input.equals("1")){
                          while(true){
                 String flag = "true";
                                 String ssn="";
                             System.out.println("Please enter the required details to register member ?");
                                 System.out.println("Are you head of the family? Enter (y/n) \n");
                                 String headMem = choice.nextLine();

                                 System.out.println("Enter your income ?\n");
                                 int income = choice.nextInt();
                                 System.out.println("Please enter Social Security Number (SSN) ?\n");

                                 ssn = choice.nextLine();

                 // check if he is head of the family and his income is less then 550
                                 if(headMem.equalsIgnoreCase("n") || income > 550){
                                         System.out.println("SORRY! You are not eligible for the SAP registration...");
                                         flag = "false";
                                         break;
                                 }

                                 // check if array list contain atleast one member to check ssn
                                 if(memList.size()>0){
                                   for(FamilyMember fm : memList){
                                    if(fm.getSsn().equalsIgnoreCase(ssn)){
                                            System.out.println("This "+ssn+" number is already exist\n");
                                            System.out.println("CONGRATULATIONS! You are already registered for the SAP....THANK YOU!\n");
                        flag = "false";

                                            break;
                                        }
                                 }
                                 }
                                 
                                 if(flag.equals("false")){
                                   System.out.print("Do you want register another member? press (y/n)? ");
                                   input = choice.nextLine();   
                                   if(input.equalsIgnoreCase("n")){
                                           break;
                                   }
                 }// falg if block
                 System.out.println("Please enter you full name: \n");

                 String name = choice.nextLine();
                                 System.out.println("Please enter you city: \n");

                                 String city = choice.nextLine();
                 System.out.println("Please enter you DOB in format (DD/MM/YYYY): \n");
                                 String dob = choice.nextLine();
                                 System.out.println("Please enter total members in your family: \n");
                                 int familySize = choice.nextInt();
                                 memList.add(new FamilyMember(ssn, name, dob, city, income , familySize));
                                 System.out.println("CONGTRATULATIONS! Your registration completed succesfully.....\n");
                 System.out.println("Your registration details are below: \n");
                                 System.out.println(" SSN:     Name:     DOB:      City:     Income:       Family Size:       Family Head  ");

                                 System.out.println(ssn+"      "+ name+ "     "+"     "+ dob+"    "+city+"    "+income+"    "+familySize+"     "+headMem+"\n");
                                  System.out.print("Do you want register another member? press (y/n)? ");
                                   input = choice.nextLine();   
                                   if(input.equalsIgnoreCase("n")){
                                           break;
                                   }
                                
               } //end of if

                         }// inner while loop
             
                         // 2. Display list of beneficiaries in the city
                        else if(input.equals("2")){
                                
                                        // you can implement this method 

                        }// else if end 
                        //3. Display beneficiaries family size
                        else if(input.equals("3")){
                                // you can implement this method 
                        }
                        // 4. Display number of beneficiaries that earn less than 100 per day.
                        else if(input.equals("4")){
                                int counter = 0;
                                for(FamilyMember fm: memList){
                                   if(fm.getIncome()<100){
                                       counter++;
                                   }
                                }
                           System.out.println("Total number of beneficiaries that earn less than 100 per day are:  "+counter);
                        }

        
                        else{
                                System.out.println("Quit from the system.");

                                break;
            }



                } // outer while loop
 
                ///// end while loop///////////////
        }
}

Output:


Related Solutions

in Java using netbeans create a project and in it a class with a main. We...
in Java using netbeans create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class, after the package statement, paste import java.util.Scanner; Part A ☑ In your main method, paste this code. Scanner scan = new Scanner(System.in); System.out.println("What is x?"); int x = scan.nextInt(); System.out.println("What is y?"); int y = scan.nextInt(); System.out.println("What is z?"); int z = scan.nextInt(); System.out.println("What is w?");...
in Java using netbeans create a project and in it a class with a main. We...
in Java using netbeans create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class, after the package statement, paste import java.util.Scanner; Part A ☑ In your main method, paste this code. Scanner scan = new Scanner(System.in); System.out.println("What is x?"); int x = scan.nextInt(); System.out.println("What is y?"); int y = scan.nextInt(); System.out.println("What is z?"); int z = scan.nextInt(); System.out.println("What is w?");...
in netbeans using Java Create a project and a class with a main method, TestCollectors. ☑...
in netbeans using Java Create a project and a class with a main method, TestCollectors. ☑ Add new class, Collector, which has an int instance variable collected, to keep track of how many of something they collected, another available, for how many of that thing exist, and a boolean completist, which is true if we want to collect every item available, or false if we don't care about having the complete set. ☑ Add a method addToCollection. In this method,...
Create a new Java project using NetBeans, giving it the name L-14. In java please Read...
Create a new Java project using NetBeans, giving it the name L-14. In java please Read and follow the instructions below, placing the code statements needed just after each instruction. Leave the instructions as given in the code. Declare and create (instantiate) an integer array called List1 that holds 10 places that have the values: 1,3,4,5,2,6,8,9,2,7. Declare and create (instantiate) integer arrays List2 and List3 that can hold 10 values. Write a method called toDisplay which will display the contents...
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder....
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder. 3. Import Scanner and Stacks from the java.util package. 4. Create a Stack object named basket. 5. The output shall: 5.1.Ask the user to input the number of fruits s/he would like to catch. 5.2.Ask the user to choose a fruit to catch by pressing A for apple, O for orange, M for mango, or G for guava. 5.3.Display all the fruits that the...
Part A Java netbeans ☑ Create a project and in it a class with a main....
Part A Java netbeans ☑ Create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class , after the package statement, paste import java.util.Scanner; As the first line inside your main method, paste Scanner scan = new Scanner(System.in); Remember when you are getting a value from the user, first print a request, then use the Scanner to read the right type...
Start NetBeans. Create a new project called Lab7. Create a Java main class file using the...
Start NetBeans. Create a new project called Lab7. Create a Java main class file using the class name YourlastnameLab7 with your actual last name. Create a Java class file for a Polygon class. Implement the Polygon class. Add a private instance variable representing the number of sides in the polygon. Add a constructor that takes a single argument and uses it to initialize the number of sides. If the value of the argument is less than three, display an error...
Create a project plan on the game or application you are creating. Using java programming. The...
Create a project plan on the game or application you are creating. Using java programming. The project plan should include the following: A description of the game or application The IDE or game engine your plan to use to create the game or app and information on how you are going to develop the game or app If you choose to create a game, how are you going to approach the game design and game development process or if you...
The project description: As a programmer, you have been asked to write a Java application, using...
The project description: As a programmer, you have been asked to write a Java application, using OOP concepts, for a Hospital with the following requirements: • The Hospital has several employees and each one of them has an ID (int), name (string), address (string), mobile phone number (string), email (string) and salary (double) with suitable data types. • The employees are divided into: o Administration staff: who have in addition to the previous information their position (string). o Doctor: who...
USING JAVA (netbeans) In your main, ask the user for an int. Do this by first...
USING JAVA (netbeans) In your main, ask the user for an int. Do this by first printing a request for the int, then creating an int x, and using the Scanner to read an int from the user and put it in x, like this: int x = scan.nextInt(); ☑ Next read in two doubles d1 and d2 from the user. This will look a lot like what you did for the int, but the scanner reads doubles using scan.nextDouble();...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT