Question:
Intro To Computer Science Homework Help Needed?
G
2013-04-02 17:22:18 UTC
Hi all,

I have to create many methods for an assignment, but I am having a problem with three of them. They are:

http://i.imgur.com/VBIhYxY.png
http://i.imgur.com/lqRnMxC.png
http://i.imgur.com/eCM8znG.png

This is the code I have so far:

public class MethodAssignment {
public static void main(String[] args) throws IOException
{

Scanner keyBoard = new Scanner( System.in );

System.out.print("Please enter the box character: ");
String boxScan = keyBoard.nextLine();
char boxChar = boxScan.charAt(0);

System.out.print("Please enter the size of the box: ");
int boxSize = keyBoard.nextInt();

int i;

for (i = 0; i < (boxSize+1)/2; i++) {

String thisLine = "|";

for (int j = 0; j < (boxSize+1)/2; j++) {

thisLine += boxChar;

}


thisLine += "|";
System.out.println(thisLine);


}
}
}

When run, this is what it asks and prints:

http://i.imgur.com/Z3ZQQxU.png

If anyone can help me with any and/or all of the methods that I need assistance with, that would be awesome. I cannot use arrays for this assignment. Thanks for your consideration.
Three answers:
Erika
2016-10-26 11:52:56 UTC
you realize, we had a similar form of major challenge again in my day, in the course of the Pliocene era, formerly than telephone phones and digital mail and internet and faraway administration television and stuff. I keep in concepts we had a coach who may write stuff on the chalk board with one hand, and formerly than you may duplicate it down on your notes, he'd erase it with the option hand. We had a tricky time in that type. observe of what we did? We went as a lot because the instructor and requested QUESTIONS. grew to change into out he changed into large old chap, awful as a instructor, yet fantastic with one on one tutoring. yet, allow you to comprehend what. right here's a initiate for you. seem on your e-e book for an outline of "cin" for the needs of analyzing a fee for the parameters. Your parameters comprise maximum room skill and the quantity of people to attend. really, those should be integers. Int max_room_capacity; int number_of_attendees; seem on your e book for an outline of the "if" statement for the applications of comparing those 2 values to be certain if the variety of planned attendees is larger than the utmost skill. seem on your e book for a depiction of the "cout" truth for the needs of printing out the outcome of that analysis. you ought to do somewhat mathematics in the case there are too many, yet that should be a portion of cake, sure? impressive , no?
cobia
2016-10-25 14:26:29 UTC
you realize, we had a similar form of major challenge again in my day, in the course of the Pliocene era, formerly than telephone phones and digital mail and internet and faraway administration television and stuff. I keep in concepts we had a coach who may write stuff on the chalk board with one hand, and formerly than you may duplicate it down on your notes, he'd erase it with the option hand. We had a tricky time in that type. observe of what we did? We went as a lot because the instructor and requested QUESTIONS. grew to change into out he changed into large old chap, awful as a instructor, yet fantastic with one on one tutoring. yet, allow you to comprehend what. right here's a initiate for you. seem on your e-e book for an outline of "cin" for the needs of analyzing a fee for the parameters. Your parameters comprise maximum room skill and the quantity of people to attend. really, those should be integers. Int max_room_capacity; int number_of_attendees; seem on your e book for an outline of the "if" statement for the applications of comparing those 2 values to be certain if the variety of planned attendees is larger than the utmost skill. seem on your e book for a depiction of the "cout" truth for the needs of printing out the outcome of that analysis. you ought to do somewhat mathematics in the case there are too many, yet that should be a portion of cake, sure? impressive , no?
School
2013-04-02 17:47:29 UTC
From the looks of it this is Java?



You are missing your imports..

import java.io.IOException;

import java.util.Scanner;



These go at the beginning of the code


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...