-3

import java.util.Scanner;

public class c1main { static Scanner s1 = new Scanner(System.in); public static void main(String[] args) { c1 c = new c1(); System.out.println("Enter the number of patients"); int n =s1.nextInt(); String cov1[]= new String[n]; int age[]= new int[n]; String gender[]= new String[n]; String bt[]=new String [n];

int i=0;

do { System.out.println("Enter your name"); c.cov1[n]=s1.next();

System.out.println("How old are you , " + c.cov1[n] ); c.age[n]=s1.nextInt();

System.out.println("Are you a male or female , " + c.cov1[n]); c.gender[n]=s1.next();

System.out.println("What is your blood type , " + c.cov1[n]); c.bt[n]=s1.next();

i++; } while(i<c.n);

AGamer
  • 1
  • 1
  • 4
    Please format your code using [code blocks](https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks) and explain your specific problem. The code you posted is also incomplete, without the `c1` class we will not be able to help you. – flwd May 10 '22 at 17:18
  • `cov1[n]` all these in the loop should probably be `cov1[i]`. You are always using the total number rather than the loop iteration count. – Nexevis May 10 '22 at 17:53

0 Answers0