Question

Hey, I have an assignment from my Data Structures class. I need the output to be:...

Hey, I have an assignment from my Data Structures class. I need the output to be:

[1] to set the student name
[2] to set the student address
[3] to set the student GPA
[4] to set the student student ID
[5] to set the student major
[6] to print student info
[7] to exit

Then I need this output to repeat another 2 times. How can I code that? Its java

Also, to code the output above, I used

int a = 1;
System.out.println("[" + a + "] to set the student name");

I repeated this code until

int g = 7

Please help. Thanks in advance

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.*;

class Sol{

public static void main(String[] args)  
{
int a=1;
for(int i=0;i<3;i++)
{
System.out.println("[" + a + "] to set the student name");
System.out.println("[" + (a+1) + "] to set the student address");
System.out.println("[" + (a+2) + "] to set the student GPA");
System.out.println("[" + (a+3) + "] to set the student student ID");
System.out.println("[" + (a+4) + "] to set the student major");
System.out.println("[" + (a+5) + "] to print student info");
System.out.println("[" + (a+6) + "] to exit");
  
System.out.println();
  
}
  

}
  
}

Add a comment
Know the answer?
Add Answer to:
Hey, I have an assignment from my Data Structures class. I need the output to be:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • java This lab is intended to give you practice creating a class with a constructor method,...

    java This lab is intended to give you practice creating a class with a constructor method, accessor methods, mutator methods, equals method , toString method and a equals method. In this lab you need to create two separate classes, one Student class and other Lab10 class. You need to define your instance variables, accessor methods, mutator methods, constructor, toString method and equals method in Student class. You need to create objects in Lab10 class which will have your main method...

  • Hello, we are currently learning the compareTo() method in my Java Data Structures class. I am...

    Hello, we are currently learning the compareTo() method in my Java Data Structures class. I am having trouble understanding what the output here will be: a = "ballD"; b= "ballDs"; System.out.println(a.compareTo(b)); I don't know how to interpret the small "s". I know that if it was a = "ballD"; b = "ballD"; the output would be 0. Please help, thanks in advance

  • I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student...

    I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student {    private String name;    private double gpa;    private int idNumber;    public Student() {        this.name = "";        this.gpa = 0;        this.idNumber = 0;    }    public Student(String name, double gpa, int idNumber) {        this.name = name;        this.gpa = gpa;        this.idNumber = idNumber;    }    public Student(Student s)...

  • How would this switch statement be modified to not use "continue"? This piece of code is...

    How would this switch statement be modified to not use "continue"? This piece of code is part of a larger assignment and that assignment prohibits the use of "continue" for switch statements. How do I modify this code so that it still does what I want it to do, without using "continue"? while (true) { choice = displayMenu(keyboard); switch (choice) { case 'D': case 'd': { courseStudents.displayStudentList();    continue; } case 'A': case 'a': { int id; double stGpa; System.out.println("Enter...

  • Hey I really need some help asap!!!! I have to take the node class that is...

    Hey I really need some help asap!!!! I have to take the node class that is in my ziplist file class and give it it's own file. My project has to have 4 file classes but have 3. The Node class is currently in the ziplist file. I need it to be in it's own file, but I am stuck on how to do this. I also need a uml diagram lab report explaining how I tested my code input...

  • Hi everyone! I need help on my Java assignment. I need to create a method that...

    Hi everyone! I need help on my Java assignment. I need to create a method that is called sumIt that will sum two values and will return the value.It should also invoke cubeIt from the sum of the two values. I need to change the currecnt program that I have to make it input two values from the console. The method has to be called sumIt and will return to the sum that will produce the cube of the sum...

  • Create a java project and create Student class. This class should have the following attributes, name...

    Create a java project and create Student class. This class should have the following attributes, name : String age : int id : String gender : String gpa : double and toString() method that returns the Student's detail. Your project should contain a TestStudent class where you get the student's info from user , create student's objects and save them in an arralist. You should save at least 10 student objects in this arraylist using loop statement. Then iterate through...

  • Hey, Im trying to understand what this code is telling me. Plus what do I need...

    Hey, Im trying to understand what this code is telling me. Plus what do I need to add to run it? Im new with coding, really trying to understand everything. Thanks String name = console.next(); if (name.startsWith("Dr.")) { System.out.println("Are you single?"); } else if (name.equalsIgnoreCase("LUMBERG")) { System.out.println("I need your TPS reports."); }

  • Add additional information to the student class below such as name, address, major, and contact information...

    Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...

  • Files given in this assignment (right-click on the file to download) Assignment7.cpp (need to complete) Student.h...

    Files given in this assignment (right-click on the file to download) Assignment7.cpp (need to complete) Student.h (Given. Just use it, don't change it!) Student.cpp (Partially filled, need to complete) 1. Assignment description In this assignment, you will write a simple class roster management system for ASU CSE100. Step #1: First, you will need to finish the design of class Student. See the following UML diagram for Student class, the relevant header file (class declaration) is given to you as Student.h,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT