This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!

Danielle Beard

Greenhorn
+ Follow
since Oct 24, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
36
Given in last 30 days
36
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Danielle Beard

So, I want to make this whole program go to only two decimal points. I got it to do it on one method, but now I want the whole program to do it, any suggestions?

2 weeks ago
A true + a true = true
A false + a true = false
A false + false = false
A true + false = false


Is this correct?
3 weeks ago
If I have a problem:
's' < 'y'

or

'T' < 'z'

how can I tell if the values are true or false?
Do you go by the numerical value in the alphabet? Does the capital characters weigh more than non capital?
3 weeks ago
Yes!!! I get it now....
So its like...

Static void means we arent doing anything, static string, char, boolean and whatnot is we are getting ready to go make some convo with someone!

So we call out what we are doing first by the name of the method:
cookingInTheKitchen

Method is formatted like:
cookingInTheKitchen:
And all of the things we do in the kitchen

Then a method name has to be generic to what we are doing so we can use it for alot of things if we need to

I'm so excited, I'm actually getting this I love you guys! Lol
3 weeks ago

/* Danielle Beard CIS120 09/17/2019 Program #3
  This program will make use of methodswith parameters and return values,
  the scanner class and String methods. It will ask the user for their full
  name and amount of the price of the item. It will then calculate sales
  cost based on 6% tax rate.
*/
//import the java.util package in order to work with the scanner class

import java.util.Scanner;//start scanner

public class DanielleBeard3 { //start class
public static void main(String[] args) {//start main
       //start of scanner for the name and amount

   final double taxRate = .060;//declare constant variables
   double price;
   double tax;
   double total;
  //create scanner object
       Scanner getName = new Scanner(System.in);
       
           System.out.println("Please enter your full name : ");//user enters name here
           String useName = getName.nextLine(); // get string    
                                                     
           System.out.println("Hi " + useName + "! Please enter the price of your item : ");
           price = getName.nextDouble();
           
           //calculate the tax
           tax = price * taxRate;
           
           //calculate total cost
           total = price + tax;
           
           
     

       //use for loop to print "-" 3 times
       //use for loop to print "-" 3 times
       for (int i = 1; i <= 3; i++) {//open for loop
           for (int j = 1; j <= 20; j++) {
               System.out.print("-");//open nested loop
           }//close for loop
           System.out.println(); //to end the line
           }
        //display prices
           System.out.println("Item price = $" + price);
           System.out.println("Tax = $" + tax);
           System.out.println("Total = $" + total);
           System.out.println();
                            }//close class
                                         } //close main




Got it to work, however, I guess my teacher wanted me to do methods? I guess I am still not understanding exactly what a method is?
3 weeks ago
Ok guys, I have to get this method thing down before I get to the next assignments, which are a billion times harder....

Do you have anything I can work on  or try out to help me practice this? You have any work for me to do and you can check it maybe?
3 weeks ago
Yeah, I am using JGrasp, it is an IDE.

I read over the turtorial on Formatting! Got you!
So, I can just use this....

public class Program3hw
{
      public static final double taxRate = .060;
{


I actually like this alot better, it's easier to find it. That actually helped me out a lot.



Ok, so I tried to fix this error. Still not working for me.....

4 weeks ago
I think I fixed alot of the issues, but I am still getting an error: illegal start of expression on public static estimateTotal.....I'm not sure what this is. I want to thank you guys for helping me out! I really do appreciate it. Coding is HARDDDDDDD. I give mad props to coders who do this day in and day out. Let me know what you think!


         
4 weeks ago

Junilu Lacar wrote:There are lots of errors in the code you posted. The lack of proper formatting makes it difficult to spot them though.

1. Your calcTotals() method is declared inside the main() method. You can't do that.

2. You have a number of variables which you declare twice. That's not a good practice as it can lead to errors and/or confusion.

3. You have semi-arbitrary code blocks where a code block is not necessary. In fact, some of those arbitrary code blocks contribute to the confusion.

Here's your code properly formatted and indented (I suggest you pay more attention to this detail in the future if you want to avoid unnecessary headaches—you're shooting yourself in the foot, in the arm, in the stomach, etc. by not formatting your code properly):

4 weeks ago
Errors coming up as:
----jGRASP exec: javac -g Program3hw.java
Program3hw.java:31: error: illegal start of expression
                                 public void Program2hw() {//method to calculate totals
                                 ^
1 error

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

I am not sure about the indentations.....I just started coding about 3 weeks ago lol. I was just following what the teacher did.

As far as all of the comments, the teacher wants them in there so she can see if we know what we are doing.......I obviously have no clue LOL.

Thank you so much for your help!!! I am so lost. I am literally brand new to coding and old.....this is terrifying lmao
4 weeks ago
Not sure what I am messing up here?









I want it to print:

4 weeks ago