Scheduling Software - Display Chart Showing Lesson Times For Particular Teacher And Students
Aug 27, 2014
I want to develop a dynamic scheduling application that I hope to use at work, but I have some questions about the design approach since this is my first undertaking of this kind of project.
The purpose of the application is to display a chart showing the lesson times for a particular teacher and her students.
Here's are more important details:
-The chart displays the current day's schedule.
-The top row displays the teacher's name. There are at least 4 teachers each day.
-The leftmost column shows the times (from 3:00 to 8:00).
-The table is filled with the names of the students.
My current problem is deciding on the best approach to storing this data containing the teacher and her students and times. I should also note that there are about 500 students and around 20 teachers (i.e. the dataset is small). Is this a problem solved using a database and JDBC or could I just write the data to file? Are there other approaches that would solve this problem?
View Replies
ADVERTISEMENT
Mar 22, 2014
I read on how to use the continue statement, but I'm failing in how to use it properly, mostly because it's not working. I'm supposed to print out what numbers are showing up and how many times for each. Plus, I have to print out 'times' instead of 'time' if there's more than one of a certain number. Right now, it's printing out all the numbers including the ones that don't get inputted.
import java.util.Scanner;
public class occurrence {
public static void main(String[] args) {
//scanner/values
Scanner input = new Scanner(System.in);
int number = 101;
[Code] ....
View Replies
View Related
Oct 21, 2014
Write a program that reads a sequence of input values and displays a bar chart of the values, using asterisks, like this:
********************** **************************************** **************************** ************************** **************
You may assume that all values are positive. First figure out the maximum value. That value's bar should be drawn with 40 asterisks. Shorter bars should use proportionally fewer asterisks.
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class Array717
{
public static void main( String[] args )
[Code] ....
The problem is that all this code does is print 1 line of *'s and what seems to be thousands of them
View Replies
View Related
Sep 26, 2014
I am trying below challenge to display first three characters three times if the size of the string is greater than 3.
Say if i send hello i should get helhelhel
if i send xyz i should get xyzxyzxyz
I wrote as below
public String front3(String str) {
if(str.length()==3){
return str+str+str;
}
if(str.length()>3){
String str2=new String(new char[]{str.charAt(0),str.charAt(1),str.charAt(2)});
return str2;
}
}
I am getting error as below
Error:public String front3(String str) {
^^^^^^^^^^^^^^^^^^
This method must return a result of type String
Possible problem: the if-statement structure may theoretically allow a run to reach the end of the method without calling return. Consider adding a last line in the method return some_value; so a value is always returned.
View Replies
View Related
Sep 12, 2014
I need to create a simply application that would display the results of two dice thrown five times and the total of those results. This is shown below in the attached file.
The problem is, I have a do-while loop that loops 6 times. Inside the loop, I have 2 random.nextInt(5) that generate random numbers. But how can I output the total? How can I make a variable equal to the sum of the two random numbers if the two random numbers are located inside a do-while loop?
Attached below is also the code I have thus far.
(Attached below is both files: what it needs to look like, and what it currently looks like)
View Replies
View Related
Mar 7, 2014
Write a program using a while-loop (and a for-loop) that asks the user to enter a string, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. (So, you will have two separate program codes, one using a while-loop and the other one using a for-loop.)
Example:
Enter a string: "Hello, JAVA is my favorite programming language."
Enter a character: e
The number of times the specified character appears in the string: 3
I don't even know where to begin I've only got this
import java.util.Scanner;
public class letterCounter {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string");
String myString = sc.nextLine();
System.out.println("Enter a letter");
String letter = sc.nextLine();
}
}
View Replies
View Related
Oct 29, 2014
I'm trying to get the program to roll a four sided die between 100 and 1000 times, depending on your input, and then displaying the answer.
public class Lab08
{
public static void main(String[] args)
{
int v1 =0, v2 = 0, v3 = 0, v4 = 0;
int n;
char response;
System.out.print("Enter number of rolls (100-1000): ");
[Code] ....
View Replies
View Related
Mar 15, 2014
Budget program. Here is my situation, I have 2 tabs in a GUI, one tab adds a transactions when the add button is clicked, and in the other tab displays a table showing all the transactions. In my code, I want it so that when the user chooses a deposit(combo box variable name = cbType, indexnumber for deposit is 0) it will add to the total and when the user chooses withdraw(index number is 1) then it will subtract it from the total. Here is the code.... (note as well, the code also adds a new row to the table)
//add button clicked
private class BtnAddActionListener implements ActionListener {
public void actionPerformed(ActionEvent arg0) {
((DefaultTableModel)table.getModel()).addRow(new Object[]{
cbMonth.getSelectedItem() + "/" + txtDay.getText() + "/" + cbYear.getSelectedItem(),
cbCategory.getSelectedItem(),
[Code] .....
So when I tested the program with 2 transactions, the first transaction was a deposit and the 2nd transaction was a withdraw. The end product was that both amounts were subtracted from the total. When I did a withdraw first and a deposit second, the amounts were both added together.
View Replies
View Related
Feb 22, 2015
I am new to Java , Every 5th date of every month , get 10$ in bank account .
View Replies
View Related
Jan 20, 2015
public void paint(Graphics g) {
g.drawImage(Background, bg1.getbX(), bg1.getbY(), this);
for(int i=0;i==400;i+=10){
g.drawImage(block1,fg1.getBlockX(),fg1.getBlockY(),this);
g.drawImage(block2,fg1.getBlockX(),fg1.getBlockY()+10,this);
}
}
This is what im dealing with right now. When i click run i only get the background image showing the other two are not showing on the screen.
View Replies
View Related
Apr 4, 2015
A school has 100lockers and100 students. All lockers are closed on the first day of school. As the students enter, the first student, denoted S1, opens every locker. Then the second student, S2, begins with the second locker, denotedL2, and closes every other locker. Student S3beginswiththethirdlocker and changes every third locker (closes it if it was open, and opens it if it was closed). Student S4begins with locker L4 and changes every fourth locker. StudentS5 starts with L5andchanges every fifth locker, and soon,until student S100 changesL100.
After all the students have passed through the building and changed the lockers, which lockers are open?Write a program to find your answer. The program should display the answer like this:
Locker x is open Locker y is open...
Locker z is open
Design requirement:
Use a method and an array of100 boolean elements,each of which indicates
whether a locker is open (true) or closed (false). Initially,all lockers are closed.
I'm not sure why it's giving me errors in my code. I'll post it below.
1
2 public class Assignment5 {
3
4 public static void main(String[] args) {
5 //create array
6boolean locker[] = new boolean[100];
7 //make them all closed
8for( int i = 0; i <= 99; i++){
9locker[i]= false;
[Code] ....
I have errors in line 12 and 14 but not sure why or how to fix them.
View Replies
View Related
Jan 12, 2015
I have an ArrayList filled with Student objects and all these students have a name. What I have to do is group these students in teams of 2 and make sure that 1. a student is not grouped with itself and 2. a student is not grouped twice.
The problem shows up when I iterate through the ArrayList and crosscheck a randomly generated number (for picking random students) with an ArrayList that contains already selected students, to make sure that we have no duplicates.
Here is my code:
public void generateTeams() {
Iterator<Student> iteration = studentsArray.iterator();
while(iteration.hasNext()) {
student1 = iteration.next();
// getRandomStudent returns a random Student object from the arraylist
student2 = getRandomStudent();
[Code] .....
If I run it like this the program will freeze an take up a lot of CPU. This is probably because the final student has no other students left to pair with and will therefore keep randomly generating a number (the while loop in the middle). The list of students is 27 long so it has to work with an odd amount of students.
Any good way to crosscheck if the student has been picked before? I have tried emptying the original ArrayList before but that ends up with the same problem of there being no students to match with.
In the while loop I have edited out the part that causes it to generate random numbers infinitely. I do need to make sure the student hasn't been picked before though.
View Replies
View Related
Jun 18, 2014
I have the program bellow that grades students(based on a two dimensional array with the answers) and i need to make it display the students based on the grades/scores in ascending order . I did that in two ways (using a array and a two dimensional array) but i have a hunch it can be done much more simple then i did it (but still using array object and nothing else ) .
public class GradeExam {
/** Main method */
public static void main(String args[]) {
// Students' answers to the questions
char[][] answers = {
[code]....
My first solution creating an array with the grades for sorting :
public class C8_3 {
public static void main(String args[]) {
// Students' answers to the questions
char[][] answers = {
{'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D'},
[code]....
View Replies
View Related
Apr 14, 2014
The purpose of this project is to determine the letter grade of students. The program needs to accept two command line arguments:
The first being the name of a disk file that contains the names of students, and their test scores, separated by commas followed by one or more spaces. Each line in the file will contain scores for one student.
The second argument is the name of an output disk file. The program is supposed to create a new output disk file using that name.
The number of students in the input file is unknown during compile time. The name of input and output files could be anything and only known during run time. Additionally, the average scores, along with the minimum and maximum scores for each test are to be displayed in the console.
Calculation: Final Score = quiz1 * .10 + quiz2 * .10 + quiz3 * .10 + quiz4 * .10 + midi * .20 + midii * .15 + final * .25
Final Score >= 90% then letter grade is A, 80%-89% B, 70%-79% C, 60-69% D, <= 59% F
input_data.txt:
firstName lastName, 100, 90, 80, 100, 89, 99, 88
firstName lastName, 90, 90, 100, 100, 99, 100, 95
firstName lastName, 100, 90, 100, 70, 78, 78, 80
firstName lastName, 80, 90, 90, 100, 89, 99, 85
etc.
output_data.txt
firstName lastName: B
firstName lastName: A
firstName lastName: F
firstName lastName: B
firstName lastName: C
averages (to appear in console)
Q1 Q2 Q3 Q4 MidI MidII Final
Average: 82.25 80.38 82.85 83.88 81.38 84.13 78.63
Minimum: 60 54 38 62 62 60 50
Maximum: 100 90 100 100 99 100 95
Press ENTER to continue...
Here's what I have so far :
import static java.lang.System.out;
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
public class LetterGrader {
[Code] .....
View Replies
View Related
Dec 13, 2014
Here is the question with my Pseudocode:
Create an application that keeps track of students. The application should have 3 new classes.
1. Create a class which will represent an instance of 1 student:
I want to be able to display the user's name (Last, First), Age (in years as an integer) and GPA (to 2 decimal points). This class only needs a constructor and a toString method.
2. Create a Team class that will represent a group of students.
This class should allow the driver class to manage students for a given course. The class will keep track of the course name and section, the students in the class, and allow the driver to specify the max number of students to keep track of.
Methods:
1.Constructor
2.It should have a method to insert a single student into the array and return a Boolean indicating success or failure.
3.It should also have a method which returns a string with all of the course and student information formatted for display. You should make the name 12 characters long.
3. Create a driver class that will manage the whole process.
Pseudocode:
BEGIN Driver main method
Initialize student count to 0
Input size of the array
Instantiate a copy of the Team class
Input a student name (or quit)
WHILE (the student name is not quit)
Input student age
Input student GPA
[Code] ....
View Replies
View Related
Apr 16, 2014
I am making a gradebook program that calculates the averages of 25 students using 2D arrays in which the students have four test grades. I have figured out how to display the averages of each student in one column but I cant seem to figure out how to display the letter grade of the average into another column.
Right now my program reads from a .txt doc
Heres what I've got.
TestGradeBook.java
import java.util.*;
import java.io.*;
public class TestGradeBook {
public static void main (String [] args ) throws IOException{
//Declarations
final int ROWS = 100;
final int TESTS = 4;
[Code] .....
GradeBook_Data.txt
Name100100100100
// basic name and grades
View Replies
View Related
Jan 14, 2014
Here is the application that does this; test your coding of class PieChartWriter with it.
import java.awt.*;
public class TestPieChart
{ public static void main(String[] args)
{ PieChartWriter p = new PieChartWriter();
p.setTitle("How I spend my day");
p.setSlice1("Sleep: 7 hours", 7, Color.black);
p.setSlice4("Recreation: 9 hours", 9, Color.gray);
p.setSlice2("In class: 3 hours", 3, Color.blue);
p.setSlice3("Homework: 5 hours", 5, Color.red);
}
}
View Replies
View Related
Oct 12, 2014
I need to make a loop that prints out a certain number of asterisks, depending on the random number generated (includes 0-24, not including 25). I'm just in basic java programming and am stuck on this task.
These are the directions given to me:
Write a loop to do the following tasks 10 times:
-Generate a random number in the range of 0 to 24 and store in an int variable named: score
-Write loop to print a bar of asterisks proportional to the value in score :
For example: , if value stored in score is 8, the bar chart should like as follows: (value of score spaced by a tab ( ) and a series of 8 asterisks in one line)
8 ********
//end of the loop
I've tried looking for other questions like this, but this one is a random number, with no input. Yes, I know there are easier ways, but my professor is extremely picky with everything.
This is what I have so far:
public class PA5LoopsA {
public static void main(String [] args) {
//Declare variables
int score;
//Generate random number between 0 and 24
score = (int) (Math.random() * 25);
[Code] ....
Clearly, none of my formatting went through...yes, I know how to space everything out!
View Replies
View Related
Oct 19, 2014
Here is the assignment instructions:
Overview: Use the Eclipse Java environment to create and test a program using methods that will display a bar graph.
Specifics: This assignment is an extension of the Module 5 activity, the first bar chart (asterisk) display program. You should also make use of the Bar Chart printing program of Chapter 6 (Fig. 6 in the textbook, p. 217).
Your program should use methods to accept input from the keyboard, store it in an array, and use that data to display a bar graph.
Pseudocode for the program might look like the following.
Main
declare an array of integers
get the number of asterisks in each bar
print the bar graph
get the number of asterisks in each bar
declare a Scanner input object
declare an array to fill and return
[code]....
Problem is I cannot get it to display the number of asterisks I enter as input.
View Replies
View Related
Mar 6, 2015
I need to create a chart for work and comes across this sample from mbostock's chord diagram (bl.ocks.org/mbostock/4062006).
I only need to revise the tick label (names, display positions) but I don't know how to do it as I have 0 experience with Java.
My sample data for the var matrix is
[0,100,100,100]
[0,0,99,98]
[0,0,92,84]
[0,99,0,0]
which shows flows between country A, B, C and D.
I would like to revise the tick labels, so that:
1) Instead of showing 0K 5K 10K, I would like to show the country names (A - D), with no number or tick. I figured out this one by just commenting out all the codes relating to ticks.
2) Place the country names in the center of the arch. I don't know how to do this one.
View Replies
View Related
Dec 31, 2013
I would like to create this type of chart with Primefaces (or another JSF API), what is the best component to use to do this:
[URL] .....
View Replies
View Related
Mar 12, 2014
I have a JScrollPane and JTable inside. In the right column of the table at the end (south) I made a ChartPanel in one of the classes where I make the design for the Frame:
Java Code:
ChartPanel chartpanel = new ChartPanel(pieChart);
pCapturing.add(chartpanel, BorderLayout.NORTH); mh_sh_highlight_all('java');
And when I click on any row above, from the list in the column, I would like an appropriate pie chart to be drawn.
I need here (in another class where I define the getTableCellRendererComponent) to enter a code to display the chart in the last row of the panel:
Java Code:
PieChart3 pie=sectionsChartProvider.getSectionPieChart(section);
...
...
if((hasFocus) || (isSelected)) {
if(column == 0)
setBorder( new MatteBorder(1, 1, 1, 0, colorBorder) );
[Code] .....
But, I don't know how to do this. I also have a class for drawing the pie chart.
View Replies
View Related
Mar 9, 2014
I use JTable and JScrollpane in my java application, and I would like for every selected row in the scroll pane, the pie chart to be made for the values in % that the row contain.
View Replies
View Related
Mar 10, 2014
i'm getting cryptic error messages for the following code:
class MyChar implements CharSequence{
private String s;
public MyChar(String input)
{
StringBuilder b = new StringBuilder(input);
b.reverse();
this.s = b.toString();
[code]....
it's telling me something's wrong with the class modifier and that my class can't implement chart
View Replies
View Related
Sep 15, 2014
I want to develop a seating chart/plan where people can pick their seat etc. I have developed the UML diagrams etc for this project and want to start with a console version before developing a GUI version. Eventually I want to create a website where users can log in and reserve their seats etc.
Without sounding like I'm putting the cart before the horse, I want to know what Java technologies I will need to develop the final part of the project. At the moment I'm using Eclipse for getting through the Java text books.
View Replies
View Related
Feb 18, 2015
I want to plot an administrative chart(flow chart of an organization) and I truly do not not know how to start.
* Collect data from database
* use jgraph or any other api to create the flow chart.
View Replies
View Related