Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class program {
- public static class topClothing {
- private String[] sleeveLength = {"None", "Cap sleeves", "Short sleeves", "3/4 length sleeves", "Long sleeves", "Long sleeves with holes", "shirt sleeve length"};
- private String primaryColor;
- private String secondaryColor;
- private String[] mannerWorn = {"Tucked over bottom", "Tucked under bottom", "Worn around waist"}; // 3rd option only for long sleeves
- public int maxquantityPockets;
- private String[][] pockets = new String[maxquantityPockets][2]; // second array value for properties
- public int getMaxquantityPockets() {
- return maxquantityPockets;
- }
- public int setMaxquantityPockets(int z) {
- this.maxquantityPockets = z;
- return z;
- }
- public int pocketNumber(int userQu) {
- // do {
- System.out.print("Please select the number of pockets you want to work with: ");
- Scanner qu = new Scanner(System.in);
- userQu = qu.nextInt();
- if (userQu > 7 || userQu < 1) {
- System.out.println("Sorry, that is not a valid number of pockets. ");
- } else {
- System.out.println("You have chosen " + userQu + " pockets to work with. ");
- return userQu;
- // break;
- } // once this complete, values erased.
- // } while (repeat == 1);
- return userQu;
- }
- private void showPockets(String[][] pockets) {
- int x;
- for (x = 0; x < pockets.length; x++) {
- pockets[x][0] = ("Pocket " + (x + 1));
- System.out.println(pockets[x][0]);
- }
- }
- // get user input and validate it
- // if outside of maximum pocket range, reject input
- // user access to individual pockets and their individual properties
- /*
- for (x = 0; x < quantityPockets.length; x++) {
- if (userQuant == quantf) {
- break;
- }
- }
- System.out.println("Please enter the pocket number you want to work with: ");
- for (x = 0; x < quantf; x++) {
- System.out.println(x);
- }
- */
- // public int managePocketsQuantity.getQuantf
- private void managePockets(String[][] a) { // get value from outside method and set within method?
- int repeat = 0;
- int x;
- int y;
- for (x = 0; x < a.length; x++) {
- a[x][0] = ("Pocket " + (x+1));
- System.out.println(a[x][0]);
- }
- do {
- System.out.print("Please enter the pocket you want to work with: ");
- Scanner pocket = new Scanner(System.in);
- String userPocket = pocket.nextLine();
- for (x = 0; x < a.length; x++) {
- if (userPocket.equals(a[x][0])) {
- break;
- }
- }
- if (x == a.length) {
- System.out.println("Sorry, we cannot work with that pocket."); // code never skips this
- x = 0;
- repeat = 1;
- } else {
- System.out.println("You have chosen to work with " + x + ". " + a[x][0]);
- }
- System.out.println("What properties would you like to have for this pocket?");
- Scanner property = new Scanner(System.in);
- String userProperty = property.nextLine();
- a[x][1] = userProperty;
- System.out.println(a[x][0] + " has the following properties: " + a[x][1]);
- repeat = 0;
- } while (repeat == 1);
- }
- // int repeat2 = 0;
- // int y;
- private boolean hood;
- private boolean zipUp;
- private void topPrint(){
- String[] printLocations = {"Chest", "Back", "Sleeves"}; // 3rd option can't be applied with sleeveless
- System.out.print("What sort of print would you like? ");
- }
- int quantity;
- }
- static int[] intInputVal(int[] userIntArray) {
- int repeat = 0;
- int x;
- do {
- System.out.println("Here is a list of the elements contained within your array: ");
- for (x = 0; x < userIntArray.length; x++) {
- System.out.println(x + ". " + userIntArray[x]);
- }
- Scanner intInput = new Scanner(System.in);
- int userIntInput = intInput.nextInt();
- for (x = 0; x < userIntArray.length; x++) {
- if (userIntInput == userIntArray[x] || userIntInput == x){
- break;
- }
- }
- if (x == userIntArray.length) {
- System.out.println("Sorry, that was not a valid menu option");
- x = 0;
- repeat = 1;
- } else {
- System.out.println("You have chosen " + x + ". " + userIntArray[x]);
- break;
- }
- // for (int t: userArray) {
- // System.out.println(x + ". " + t);
- // }
- } while (repeat == 1);
- return userIntArray;
- }
- static String[] strInputVal(String[] userStrArray) {
- int repeat = 0;
- int x;
- do {
- System.out.println("Please select the " + userStrArray[userStrArray.length - 1] + " of your garment: ");
- for (x = 0; x < userStrArray.length - 1; x++) {
- System.out.println(userStrArray[x]);
- }
- Scanner strInput = new Scanner(System.in);
- String userStrInput = strInput.nextLine();
- for (x = 0; x < userStrArray.length - 1; x++) {
- if (userStrInput.equals(userStrArray[x])){ // cannot use == comparators as comparing string values!
- break;
- }
- }
- if (x == userStrArray.length - 1) {
- System.out.println("Sorry, that was not a valid menu option");
- x = 0;
- repeat = 1;
- } else {
- System.out.println("You have chosen " + userStrArray[x]);
- break;
- }
- } while (repeat == 1);
- return userStrArray;
- }
- public static void main(String[] args){
- System.out.println("Hello World!");
- int[] array = {33,34,35,36};
- intInputVal(array);
- topClothing shirt = new topClothing();
- strInputVal(shirt.sleeveLength);
- shirt.pocketNumber(shirt.maxquantityPockets);
- shirt.showPockets(shirt.pockets);
- shirt.managePockets(shirt.pockets);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement