Student Class That Includes Boolean
Feb 7, 2015
Create an abstract class called Student. The Student class includes a name and a Boolean value representing full-time status. Include an abstract method to determine the tuition, with full-time students paying a flat fee of $2,000 and part-time students paying $200 per credit hour. Create two subclasses called FullTime and PartTime. Create an application that demonstrates how to create objects of both subclasses."
public abstract class Student {
private String name;
private int credits;
public Student(String name){
this.name = name;
credits =0;
[code]....
View Replies
ADVERTISEMENT
Oct 9, 2014
Creating a class. Specification are given as:
Create a class called Employee that includes three pieces of information as instance variables:
-Employee ID (string type)
-first name (string type) (default value 'John')
-last name (string type) (default value 'Smith') and
-monthly salary (type double).
-No argument constructor that initializes the three instance variables. The employee id should be generated using the following process:
The employee id should be a combination of first initial, last initial and a number starting from 10001 for the first employee and increasing by one for each employee. e.g. if John Smith is the first employee then its id will be JS10001 and if George Brown is the second employee then its id will be GB10002
-Provide get and set methods for each instance variable. The set method for monthly salary should ensure that its value remains positive - if an attempt is made to assign a negative value, leave the original value.
View Replies
View Related
Mar 26, 2015
I want to create a Student class that is able to search, borrow, return, and reserve books. This is what I have done so far:
public class Student
{
private String username;
[Code].....
I think that I might need an array where to remember all of the books that the student has borrowed, but I'm not sure how to do that as well.
View Replies
View Related
Dec 15, 2014
i am very new to Java and i need to create a code that includes check-boxes, radio-buttons, and drop down menus. I decided to make a server order form and listed choices of appetizers, entrees, and desserts. I also need to create a button that combines all selected menu items and outputs the final food order. I also need to create a reset button.
View Replies
View Related
Mar 27, 2015
I just have not got the chance to spend much time on it lately I know a bit but I'm not an expert or even intermediate with Java so I'm trying to make a program where the teacher enters the grade of each student and its stored in a variable the only problem is if I use a for loop the variable in which the result will be stired will be overwrite by the last repetition of the loop,I think the idea would be a nested loop but how I would go about using it in this situation,
here is my java code.
import java.util.Scanner;
class maths{
public static void main(String[] args)
[Code].....
View Replies
View Related
Oct 3, 2014
Below mentioned table which show data on WEB page, thereof i need to develop page for my practice, steps to develop this like as following.
1.Tool Required to develop
2.Connectivity JDBC
create table student
(ROLLNO NUMBER,
NAME VARCHAR2(20),
DOB DATE,
REG_DATE DATE,
ADDRESS VARCHAR2(100),
PIC LONG
)
INSERT INTO STUDENT VALUES(1,'ALI',TO_DATE('01-JAN-1982'),SYSDATE,'','');
INSERT INTO STUDENT VALUES(2,'JHON',TO_DATE('01-JAN-1985'),SYSDATE,'','');
INSERT INTO STUDENT VALUES(3,'CHARLI',TO_DATE('01-JAN-1990'),SYSDATE,'','');
View Replies
View Related
Nov 12, 2014
For my lab this week I have to print out four arrays. The arrays have to be 5 units long. The first three arrays are the student's exam grades for exam 1, 2 & 3 and the fourth array should be the average for each student's three tests. The program should ask the user to input the grades in and then the program should compute the average. For example the program should print this if these are the exam grades the user imputs:
Exam 1 Exam 2 Exam 3 Average
65 79 80 74.66
79 82 59 73.33
99 100 98 99
and so on.......
I thought I wrote the program perfectly and when I compile it there are no errors but when I run it, it only lets me input the numbers for the first three students and then prints out something so strange.
here is my program:
public class Lab9{
public static void main(String[] args){
java.util.Scanner input = new java.util.Scanner(System.in);
int i, sum;
double avg;
sum = 0;
int A[ ] = new int [5];
int B[ ] = new int [5];
int C[ ] = new int [5];
double avg1[ ] = new double[5];
[code]....
View Replies
View Related
Feb 15, 2015
I'm writing a Java program to get the gpa of a student as a command line argument. Then display the class of the degree according to some criteria. Here is my code. But it says "ArrayIndexOutOfBoundsException :0". How can I fix this?
public class Stgpa
{
public static void main(String[] args)
{
double gpa= Double.parseDouble(args[0]);
if(gpa>=3.6)
System.out.println("Class of the degree is: First Class Hons");
else if(3.6>gpa && gpa>=3.4)
[Code]...
View Replies
View Related
Apr 8, 2014
prompts user for the grades of each of the students and saves them an int array called grades. Your program shall check that the grade is between 0 and 100. program should then check if the grade is equal to or greater than 50, where 50 is the pass rate.
A sample output :
Enter the number of students: 3
Enter the grade for student 1: 55
Enter the grade for student 2: 108
Invalid grade, try again...
Enter the grade for student 2: 56
Enter the grade for student 3: 57
The average is 56.0
The maximum is 57
The minimum grade is 55
The number of fails is 0
The number of passes is 3
..
I am quiet stuck on this one.
View Replies
View Related
Jun 1, 2014
I have to read in a file that that has Student, Employee, Faculty....such as name, last name, salary...etc
Example of a file input
Java Code: Student, John, Doe, [email]johnDoe[At]yahoo.com[/email], 123,Wonderland Ave, 21323,TX
PhoneNumber,Cell,111,222,3333
Student, Jesus,Satan,[email]jesus[At]satan.com[/email,666, HeavenHell Dr., 666666,CA
PhoneNumber,Work,111,333,5555 mh_sh_highlight_all('java'); Java Code: while(input.hasNext()){
[code]...
There is more code, but it's repetitive. Now, I keep getting an error. Array of bounds. I believe i get the error because the phone number. The phone number is on the next line..I created a different arraylist for phonenumber, but I dont know how to match it with the correct person, student, employee...etc.
View Replies
View Related
Oct 22, 2014
Write a program that promts a professor to input grades for five different courses for 10 students. Prompt the professor to enter only A,B,C,D, or F for grades(A is the highest grade, F fail). use variables for student number(1 through 10) and grade numbers(1 through 5). create a menu for Search. if the user select search it will prompt a letter correspond to grade. display all student with selected grade. if the user just enter nothing, display all student with their grade sorted from highest to lowest.
View Replies
View Related
Dec 8, 2014
It doesn't work and I always get UnknownFormatConversionException...
public class studentPoll {
{
public static void main( String[]args)
{
int[] responses = { 1, 2 , 5, 4, 3 , 5, 2, 1 , 3, 3, 1, 4, 3, 3, 3,
2, 3, 3, 2, 14 };
[Code] .....
View Replies
View Related
Oct 21, 2014
A University offers a course that prepares students for the county licensing exam for real estate brokers. Last year, twenty students who completed this course took the exam. The university wants to know how well its students did an exam. You have been asked to write a program to summarize the results. You have been given a list of these 20 students. Next to each is written a1 if the student passed the exam or a2 if the student failed the exam.Your program should analyze the results as follows:
i.Input each test result (i.e., a1 or a2). Display the message Enter result on the screen each time the program requests another test result.
ii.Count the number of test results of each type.
iii.Display a summary of the test results, indicating the number of students who passed and the number who failed.
iv.If more than 15 students passed the exam, output message, Bonus to the instructor
View Replies
View Related
Feb 15, 2015
I want to write a java program which displays to get the GPA of a student as a keyboard input. Then display the class of the degree according to the following criteria using a switch-case statement (if-else statements cannot be used). If the user insert an invalid gpa you should display a message Invalid GPA.
gpa ≥ 3.50 First Class Hons
3.49 ≥ gpa ≥ 3.00 Upper Second Class Hons
2.99 ≥ gpa ≥ 2.50 Lower Second Class Hons
2.49 ≥ gpa ≥ 2.00 Pass
2.00 ≥ gpa Fail
Here is my code:
import java.io.*;
public class q7
{
public static void main(String[] args)
{
InputStreamReader ISR=new InputStreamReader(System.in);
BufferedReader BR=new BufferedReader(ISR);
[code]...
.But when I use Command console to run this it says: 1111.jpg. I also wanna know is there another way to do this with switch- case statements.
View Replies
View Related
Nov 23, 2014
I had to make a program that allowed the user to enter the number of students and the students names and grades and then print out the name with the grade in descending order. right now I only have it where it prints the names out in descending order. how do I get it the print out with the grade?
Here is my code
import java.util.*;
public class Grades {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of students: ");
int numofstudents = input.nextInt();
[Code] .....
View Replies
View Related
Feb 19, 2014
I have written a program student record system but can not save data to view or submit record. Able to run the program but failed to submit record or view pre-submitted records.
Student.java
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class Student extends Frame implements ActionListener {
String greeding="";
Button btnNewStudent;
[Code] .....
View Replies
View Related
Jun 11, 2014
I do not see a boolean trying to be converted into an int. Could my decompiler have caused this?
this.redStones[this.tabIDHover == i].drawSprite(6 + paddingX + ((client.clientSize >= 1) ? 2 : 0) - ((this.longTabs && client.clientSize >= 1) ? 240 : 0) + x, 261 + paddingY + ((this.longTabs && client.clientSize >= 1) ? 37 : 0) - ((client.clientSize == 0) ? 261 : 0));
this.redStones[this.tabIDHover == i + 8].drawSprite(6 + paddingX + ((client.clientSize >= 1) ? 2 : 0) + x, 298 + paddingY);
View Replies
View Related
Dec 11, 2014
I am making a program which accepts two user inputs one being a letter either upper or lower case and the other being a number. the out come should be some thing like this:
G
GG
GGG
GGGG
GGGGG
This is assuming the user inputted 'G' and '5'.
here is the code i have so far:
package week10;
import java.util.Scanner;
public class integer {
public static void main(String args[]) {
Scanner user_input = new Scanner( System.in );
[Code] ....
The problem i am having is that i cant get the number that is inputted to be accepted as a variable to be used for the program.
View Replies
View Related
Apr 14, 2014
how to determine if an integer is even or odd by using a boolean method. I think I have the method right, but it's calling the method into the main that has got me stumped.
import java.util.Scanner;
public class Odd_Even {
public static void main(String[] args) {
//Scanner, variables
Scanner input = new Scanner(System.in);
int number;
[code]....
View Replies
View Related
Sep 25, 2014
So I'm trying to check if the new coordinates vs original coordinates are diagonal and 1 line further, and if there is a piece there(getNum()) if it's 2 lines further, so I'm trying to return a boolean value then.
so if it's the first if, it returns true, if it's the 2nd it returns true, then I say else for all other scenario's, and return false there, but my compiler says my method is missing a return statement.
public boolean check(int[] d) {
int x,y;
x = loc[0][0];
y = loc[0][1];
int sx = d[0];
int sy = d[1];
[Code] .....
Edit: used a local boolean and returned that after my if's.,
View Replies
View Related
Apr 14, 2015
code=Java
import java.util.Random;
import java.util.Scanner;
public final class Derp {
public static int WIN, Tick;
public static Scanner Input = new Scanner(System.in);
[code]...
why this boolean statement isn't working correctly. It's not detecting that the WIN and Tick are the same and instead chooses to always run the second statement.
View Replies
View Related
Feb 15, 2014
I have this project due and its asking that i print out what type of triangle it is when the user inputs 3 sides. I have most of it done and working, but it pops up different windows instead of using one window for everything. The assignment says it needs all the final info to be in one window. The boolean is coming from another method. I'm unsure how to get it into a string (Or if that's what i have to do). The method must return a boolean true/false.
import javax.swing.*;
public class Triangle {
public static void main(String[] args) {
int side1 = getSides();
int side2 = getSides();
int side3 = getSides();
[Code] ....
View Replies
View Related
Dec 1, 2014
I read in a book that when you change the value of a method parameter that's a boolean or other basic datatype within the method it only is changed within the method and remains the same outside. I want to know if there is some way for me to actually change it within the method. For example:
public class Change {
void convert(boolean x, boolean y, boolean z) { //i want to set x,y, and z to false in this
x = false;
y = false;
z = false;
[code]...
I want to put in part1, part2, and part3 when i call the method than i want them to be set to false within the method. The specific reason i asked this question was because im trying to code a battleship and i have a subroutine class with a method that when its called it checks if a ship has been sunk. If the there was a sink than the method will set a ton of boolean variables to false.
Just to clarify, I want something like this:
void convert(thing1,thing2,thing3,thing4) {
//some code here that sets thing1,thing2,thing3, and thing4 to false
}
// than in main:
boolean test1 = true;
boolean test2 = true;
[code]....
View Replies
View Related
Mar 30, 2015
I wrote a class for encapsulating coins and I was to do a boolean statement but when I test the statement the results are not showing.Here is the code for my coin class coins.java
package project_3;
/**
*
* @author user a
*/
public class Coins {
private double pennies;
private double nickles ;
private double dimes ;
private double quarters ;
private int dollars ;
[code]...
View Replies
View Related
Mar 31, 2014
what is default literal for Boolean data type?
View Replies
View Related
May 24, 2015
I want to write a program that ask if you want to go to the movies. If the user type in yes then it'll print out (Alright let go) but if the user type no then it would print (whatever). The trouble that I'm having is. What's the best way to use Boolean and Strings together in a if statement?
public class Night {
static Scanner UserInput = new Scanner (System.in);
public static void main (String [] args){
boolean user1, user2;
user1 = true;
user2 = false;
[Code] ....
View Replies
View Related