Explore BrainMass

Explore BrainMass


    Legal Java variable names and a Basic Program.

    This program calculates profits and sales prices for a furniture company. -First calculate the profit, then calculate the sales price, then calculate the profit when the sale price used. -Profit is defined as the retail price minus the wholesale price. -The sales price 20% deducted from the retail price. -The sal

    Declaring and initializing Java variables

    Need help with declaring and initializing java variables. I am trying to compile and execute a program. I have downloaded the file and attached it. Sample: Calculate your age in the year 2060. 1. Declare an integer variable name newAge. 2. Declare and initialize an integer variable named currentAge. Initialize this vari

    Rectangle class using Java

    Create a Rectangle class with - Private attributes for width and height - A default constructor that sets the height to 10 and width to 25. - An overloaded constructor that takes integer width and height arguments, uses a separate method to check whether the width and height fall within the range between 0 and 30, and throws

    Java Creating a Class Called Date

    Create a class called SimpleDate that includes three instance variables - a month, a day and a year (all type int). Provide a constructor that initializes the three instance variables and validates that those values are correct (follow calendar rules) and throws an exception for incorrect values. Provide a set and get method for

    Abstract Classes of Fish

    Create an abstract class called Aqualife. Aqualife has the following attributes: name age lakeFish oceanFish Aqualife defines 2 abstract methods called eats() and procreates(). A third concrete method called breathes() displays that 'These creatures breathe from gills.' Create subclasses of Aqualife: Fish Whale

    java code loop

    Please use a simple integer loop and branching statements to play a fictitious game of foo bar baz. Create a program that loops from 1-50 and prints each value on a separate line. Also print foo for every multple of three, bar for every multiple of five, and baz for every multiple of seven Partial Output From the FooBarBaz pr

    public class

    public class CustomerM { public static void main(String[] Jim) { Customer cust1 = new Customer("Joe", 19); System.out.println(cust1.name); System.out.println(cust1.age); cust1.name = "Jim"; cust1.age = 20; System.out.println(cust1.name); System.out.println(cust1.age);

    Java Program Class Members

    Create a Java program that manipulates at least two objects instantiated from the Dog class. Your class must include at least five private attributes, three setter and three getter methods which are the public interface and two constructors. All the class members must be used during your program run. Your program must include th

    Java GUI program- Java Retail Markdown Calculator

    A retailer would like a calculator to indicate sale prices when he marks items down at various percentages. Using Java Language Design, implement, test, and debug a GUI application that allows the retailer to enter the item's name, the item's original price, and the percentage discounted. The application should include a

    Auto Java Class

    public class Auto{ public int miles; public int gas; } 1. Encapsulate this class ( set vars to private.) Provide getmethods and setmethods for each variable 2. Add a default constructor which initializes miles and gas to zero 3. Overload this constructor which takes 2 parameters: inputmiles and inputgas. This constructo

    Java Programming

    Create a Building class and two subclasses, House, and School. The Building class contains fields for square footage and stories. The House class contains additional fields for number of bedrooms and baths. The School class contains additional fields for number of classrooms and grade level (for example elementary or junior high

    Non-GUI Java program for course

    I am looking for a program using the following classes : Course, Section, Instructor, Students, and optional CourseRoster, and GradeBook. It has to print out the course name, instructor name, 5 students with 3 grades for each student. I am attaching what I have made in eclipse so far. I don't think the CourseRoster, and GradeBo

    Writing Definitions for Informatics

    Instructions: Write a definition in your own words for each of the terms below. 1. Hardware 2. Software: 3. Network: 4. Data: 5. Information: 6. Database:

    Java - Fill in Question

    Add a class FillInQuestion to the question hierarchy of How To 10.1. An object of this class is constructed with a string that contains the answer, surrounded by _ _, for example, "The inventor of Java was _James Gosling_". The question should be displayed as The inventor of Java was _____ Here is a sample program run:

    Provide a Java class named Input containing the method readInt that displays the prompt string, reads an integer, and tests whether it is between the supplied minimum and maximum.

    Provide a Java class named "Input" containing the method "readInt" (prototype given below) that displays the prompt string, reads an integer, and tests whether it is between the supplied minimum and maximum. If not, it prints an error message and repeats the entire process. public static int readInt(Scanner in, String prompt,

    Java - Find Reserved Word

    Write a program Find that searches all files specified on the command line and prints out all lines containing a reserved word. For example, if you call java Find ring report.txt address.txt Homework.java, then the program might print: report.txt: has broken up an international ring of DVD bootleggers that address.txt: Kris

    Java - Reverse String

    Write a program that replaces each line of a file with its reverse. For example, if you run java Reverse HelloPrinter.java then the contents of HelloPrinter.java are changed to retnirPolleH ssalc cilbup { )sgra ][gnirtS(niam diov citats cilbup { wodniw elosnoc eht ni gniteerg a yalpsiD // ;)"!dlroW ,olleH"(nltnir

    Java - Purse Methods

    Write a method for the Purse class public boolean sameCoins(Purse other) that checks whether the other purse has the same coins, perhaps in a different order. For example, the purses Purse[Quarter,Dime,Nickel,Dime] and Purse[Nickel,Dime,Dime,Quarter] should be considered equal. You will probably need one or more help

    Java - Purse

    Write a method for the Purse class public boolean sameContents(Purse other) that checks whether the other purse has the same coins in the same order. Complete the following class in your solution: import java.util.ArrayList; /** A purse holds a collection of coins. */ public class Purse { private ArrayList<St

    Writing Programs in Java

    The programming assignment for this module is programming exercise #7 on pages 861 and 862, with the following modifications. - For part 'a' the source code for class Roman is attached to this assignment. You do not have to include the method decimalToRoman as you modify this class. Also, class Roman is not used in your test

    Java Class for services offered by a hair-styling salon.

    The Curl Up and Dye Salon offers a variety of salon services for its customers. Jane Fields, the owner, has contracted to have you write a program that allows reports to be output, sorted by each type of service offered. Table below shows the various services, service prices, and service times. Service

    Java Nearest Neighbor Algorithm

    Please assist with a java class named "Topology" that includes methods "NearestNeighbor" and "RandomNeighbor". Given an Array object of type String that may list a variable amount of network client node IDs (2100, 2101 ... 2109, 2110) and their own corresponding Cartesian coordinates (i.e., xPos, yPos), the "NearestNeighbor" me

    Java Program: Convert Numerical Grade To Closest Letter Grade

    Write a Java program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade; for example, 2.85 should be a B. Any value >= 4.15 should be an A+. Write a class Grade with a method

    Java program that translates a letter grade into a number grade.

    Write a Java program that translates a letter grade into a number grade. Letter grades are A B C D F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1, and 0. There is no F+ or F-. A + increases the numeric value by 0.3, a - decreases it by 0.3. However, an A+ has the value 4.0. All other inputs have value -1.

    Graphical application in Java that displays a checkerboard

    Write a graphical application in Java that displays a checkerboard with 64 squares, alternating white and black. Please refer to the attachment for sample program output. Your main class should be called CheckerBoardViewer. You need to supply the following classes in your solution: CheckerBoard CheckerBoardComponent

    Graphical Application that Draws a Spiral

    Write a graphical application that draws a spiral, such as the following: Your main class should be called SpiralViewer. Complete the following class in your solution: public class SpiralGenerator { // private implementation . . . /** Creates a spiral generator. @param initialSize the size

    Implementing Line Equations In Java

    A line in the plane can be specified in various ways: by giving a point (x, y) and a slope m by giving two points (x1, y1), (x2, y2) as an equation in slope-intercept form y = mx + b as an equation x = a if the line is vertical Implement a class Line with four constructors, corresponding to the fou

    Java Program average numbers

    The number closest from the average is the number From the list closest to the average. Also, your test plan would be very incomplete as I was asking for 6 test: taking the average of 1 number does not seem to be a very extensive test either. you don not need screen dump for the test. just a table with list of inputs and expec