Something like this?

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

#define SUITS 4
#define FACES 6
#define CARDS 24
#define HAND 5
// prototypes
void shuffle(unsigned int wHand[][FACES]); // shuffling modifies wDeck
void deal(unsigned int wHand[][FACES], const char *wFace[],
        const char *wSuit[]); // dealing doesn't modify the arrays
void one_jack(unsigned int wHand[][FACES], const char *wFace[], const char *wSuit[]) ;
int main(void) {
    // initialize deck array
    //unsigned int deck[SUITS][FACES] = {0};
    unsigned int hand[SUITS][FACES] = {0};

    srand(time(NULL)); // seed the RNG
    shuffle(hand); // shuffle the deck

    // initialize suit array
    const char *suit[SUITS] = {"Hearts", "Diamonds", "Clubs", "Spades"};

    // initialize face array
    const char *face[FACES] = {"Ace", "Nine", "Ten","Jack", "Queen", "King"};

    deal(hand, face, suit); // deal the deck
    one_jack(hand, face, suit); // looks for Jack in hand

}

// shuffle cards in deck
void shuffle(unsigned int wHand[][FACES]) {
    // for each of the cards, choose slot of deck randomly
    for (size_t card = 20; card <= CARDS; card++) {
        size_t row;
        size_t column;

        // choose new random location until unoccupied slot found
        do {
            row = rand() % SUITS;
            column = rand() % FACES;
        } while (wHand[row][column] != 0);

        // place card number in chosen slot of deck
        wHand[row][column] = card;
    }
}

// deal cards in deck
void deal(unsigned int wHand[][FACES], const char *wFace[], const char *wSuit[]) {
    // deal each of the cards
    for (size_t card = 20; card <= CARDS; card++) {
        // loop through rows of wDeck
        for (size_t row = 0; row < SUITS; ...

So should I make a hand function then?

This is what I did before I saw your reply, I think it's the same concept.

So, since arrays typically go from 0-??????? I set the column = 0 since that would be Ace

/***************************************************************************
 * Filename: card_shuffle_deal.c
 * Author: Kate Bowers
 * Description: Shuffles and deals deck of cards using arrays of pointers
 * ************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

#define SUITS 4
#define FACES 6
#define CARDS 24

// prototypes
void shuffle(unsigned int wDeck[][FACES]); // shuffling modifies wDeck
void deal(unsigned int wDeck[][FACES], const char *wFace[],
        const char *wSuit[]); // dealing doesn't modify the arrays
void one_ace(unsigned int wDeck[][FACES], const char *wFace[], const char *wSuit[]) ;
int main(void) {
    // initialize deck array
    unsigned int deck[SUITS][FACES] = {0};

    srand(time(NULL)); // seed the RNG
    shuffle(deck); // shuffle the deck

    // initialize suit array
    const char *suit[SUITS] = {"Hearts", "Diamonds", "Clubs", "Spades"};

    // initialize face array
    const char *face[FACES] = {"Ace", "Nine", "Ten","Jack", "Queen", "King"};

    deal(deck, face, suit); // deal the deck
    one_ace(deck, face, suit);
}

// shuffle cards in deck
void shuffle(unsigned int wDeck[][FACES]) {
    // for each of the cards, choose slot of deck randomly
    for (size_t card = 20; card <= CARDS; card++) {
        size_t row;
        size_t column;

        // choose new random location until unoccupied slot found
        do {
            row = rand() % SUITS;
            column = rand() % FACES;
        } while (wDeck[row][column] != 0);

        // place card number in chosen slot of deck
        wDeck[row][column] = card;
    }
}

// deal cards in deck
void deal(unsigned ...

On the array
Row section: Hearts = 1, Diamonds = 2, Clubs = 3, Spades = 4
Column section: A = 1, Nine = 2, Ten = 3, Jack = 4, Queen = 5, King = 6

So I need to somehow find an array index with [4][ ] meaning Jack and suit. Is that what you mean?

It gives this error

/home/name/Desktop/School/Unix/Programs/hw5/draper_card_shuffle_deal_modified.c: In function ‘ace’:
/home/name/Desktop/School/Unix/Programs/hw5/draper_card_shuffle_deal_modified.c:81:27: warning: comparison between pointer and integer
if (wDeck[face][suit] == "Ace") {

And I understand the comparison error, but it's just fusterating because I can't figure out another way to do it. I see you said return bool. Do you mean assign boolean true for Ace?

I can't edit again for some reason, but I changed my code to this, but still no luck.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define SUITS 4
#define FACES 6
#define CARDS 24

// prototypes
void shuffle(unsigned int wDeck[][FACES]); // shuffling modifies wDeck
void deal(unsigned int wDeck[][FACES], const char *wFace[],
        const char *wSuit[]); // dealing doesn't modify the arrays
void ace(unsigned int wDeck[][FACES], const char *wFace[],
        const char *wSuit[]);
int main(void) {
    // initialize deck array
    unsigned int deck[SUITS][FACES] = {0};

    srand(time(NULL)); // seed the RNG
    shuffle(deck); // shuffle the deck

    // initialize suit array
    const char *suit[SUITS] = {"Hearts", "Diamonds", "Clubs", "Spades"};

    // initialize face array
    const char *face[FACES] = {"Ace", "Nine", "Ten","Jack", "Queen", "King"};

    deal(deck, face, suit); // deal the deck
}

// shuffle cards in deck
void shuffle(unsigned int wDeck[][FACES]) {
    // for each of the cards, choose slot of deck randomly
    for (size_t card = 20; card <= CARDS; card++) {
        size_t row;
        size_t column;

        // choose new random location until unoccupied slot found
        do {
            row = rand() % SUITS;
            column = rand() % FACES;
        } while (wDeck[row][column] != 0);

        // place card number in chosen slot of deck
        wDeck[row][column] = card;
    }
}

// deal cards in deck
void deal(unsigned int wDeck[][FACES], const char *wFace[], const char *wSuit[]) {
    // deal each of the cards
    for (size_t card = 20; card <= CARDS; card++) {
        // loop through rows of wDeck
        for (size_t row = 0; row < SUITS; row++) {
            // loop through ...

So I have a poker type program where it should shuffle and deal a deck of cards using arrays of pointers. I have to write a function that uses a pointer(s) to determine if the hand contains an Ace. If I can understand this one, I'd be able to do the rest with no problems. I was told to do what I did with int decks, int dealt, int the_hand, but I keep getting errors. I've been trying everything I could think of, but no luck. Am I even in the right direction?

Also, I read the book, reviewed my teachers notes, and even tried Googling this, but none of them helped. My teacher gave me a hint, but won't say anything else " Use the same parameter list as the deal function".

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SUITS 4
#define FACES 6
#define CARDS 24
#define THE_HAND 5

// prototypes
void shuffle(unsigned int wDeck[][FACES]); // prototype to shuffle deck
void deal(unsigned int wDeck[][FACES], const char *wFace[],
        const char *wSuit[]); // dealing doesn't modify the arrays
int has_ace(int *the_hand);
int main(void) {
    // initialize deck array
    unsigned int deck[SUITS][FACES] = {0};
    int *decks = malloc(CARDS * sizeof(int));
    int dealt = 0; //number of cards taken from deck
    int *the_hand = NULL; //current hand
    srand(time(NULL)); // seed the RNG
    shuffle(deck); // shuffle the deck
        if (has_ace(the_hand)){
        printf("The hand has Jack\n");
    }
    else{
        printf("The hand has no Jack\n");
    }
    // initialize suit array
    const char *suit[SUITS] = {"Hearts", "Diamonds", "Clubs", ...

A friend told me to do something like add the dank = dankestmemes() part after the if statement so it updates the variable when it loops around it'll produce a different result. But I'm still getting the same output.

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS};

int dankestmemes(void); // function prototype

int main(void) {   

    srand(time(NULL)); // randomize random generator using current time
    enum meme dankMeme; // can contain YEE, WAE, DOGE, HARAMBE, or BUTKUS   
    int dank = dankestmemes(); // When program first executes
    char option;

    do{
        switch(dank){     
            case 0: // You will be put in the Yee dinosaur tribe
                dankMeme = YEE;  // Possibly the greatest meme in existance
                printf("You belong to the tribe of Yee. Where the most obnoxious beings reside. Here you  \n"); // I recommend watching the YouTube video
                printf("well endure endless singing.\n"); // https://www.youtube.com/watch?v=q6EoRBvdVPQ
                break;        

            case 1: // You will be put in the Ugandan Knuckles tribe
                dankMeme = KNUCKLES; // #EBOLA
                printf("You belong to the tribe of Ugandan Knuckles. Welcome my brutha, here you will find those \n");
                printf("who are adventurous. We strive to find our queen and da wae.\n"); 
                break;

            case 2: // u will b put in tribe of Doge
                dankMeme = DOGE;
                printf("U BELONG 2 THE TRIBE OF DOGE. MUCH WOW VERY AMAZE!!\n");
                break;

            case 3: // You will be put in the tribe of Harambe
                dankMeme = HARAMBE; // RIP in Peace sweet prince 
                printf("You belong to the tribe of Harambe! Here you will feel ...

It gives me this:

warning: implicit declaration of function ‘dankestmemes’ [-Wimplicit-function-declaration]
     int dank = dankestmemes(); // When program first executes

I did the
while(option != 'y' && option != 'Y');

thing and this is the output:

You belong to the tribe of Harambe! Here you will feel the presence of his amazing grace. Only the wise and strong reside in this tribe.
No wonder why this tribe is everyone's favorite.
Want to be resorted? Y/N: Y

and then it just goes back to bash from there. What confuses me is that it wants to work, but it isn't randomizing the outcomes :/

I just looked at the code and I just realized, that somehow I got to implement it inside the int dankestmemes(void) function or make a function prototype that allows you to play again but I'm not sure, because it doesn't seem to randomize at all, but I'll try what you said.

How can I make this to continue until the user presses N? I've tried using while(1), while( option == 'y' || option == 'Y') but it kept giving an error for that, and if/else statements but no luck. So I decided to try a do while statement and same results, it seems it is working, but I don't know what I'm doing wrong. I even tried moving all the statements to different areas and still nothing.

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS};

int dankestmemes(void); // function prototype

int main(void) {   

    srand(time(NULL)); // randomize random generator using current time
    enum meme dankMeme; // can contain YEE, WAE, DOGE, HARAMBE, or BUTKUS   
    int dank = dankestmemes(); // When program first executes
    char option;

do{

    switch(dank){

        case 0: // You will be put in the Yee dinosaur tribe
            dankMeme = YEE;  // Possibly the greatest meme in existance
            printf("Yee. Where the most obnoxious beings reside. Here you  \n"); // I recommend watching the YouTube video
            printf("well endure endless singing.\n"); // https://www.youtube.com/watch?v=q6EoRBvdVPQ
            break;        

        case 1: // You will be put in the Ugandan Knuckles tribe
            dankMeme = KNUCKLES; // #EBOLA
            printf("Ugandan Knuckles. Welcome my brutha, here you will find those \n");
            printf("who are adventurous. We strive to find our queen and da wae.\n"); 
            break;

        case 2: // u will b put in tribe of Doge
            dankMeme = DOGE;
            printf("DOGE. PPL IN THS TRIBE ARE MUCH WOW VERY AMAZE\n");
            break;

        case 3: // You will be put in ...

I'm not looking for others to do my homework, I just want help with getting an idea one what to do.

My class was given an assignment and one of the questions is:

Create a query that will show the order id, item id, price, sales tax and subtotal for all items in the order item table. Create column aliases to describe the sales tax and subtotal columns. Only include in your output those items that
sold for $20 or more. Order your output by order id. Your output should look like the following:

orderid Item ID Price Sales Tax Subtotal

1004 1004 32.50 1.9500 34.4500
1016 1020 47.95 2.8770 50.8270
1018 1018 47.50 2.8500 50.350

Here is what I got so far:

select *
,cast(round((price) * 0.06, 4)as numeric(6,4)) as [Sales Tax]
--,cast(price as varchar(10)) as [Subtotal]
,cast(price + [Subtotal] as varchar(20)) as [Subtotal]
from order_item
where price >= 20
order by orderid asc;

I don't know what I'm doing wrong. I got everything else correct, but I am stumped at the part with finding the subtotal, would someone be able to give me an idea on what I should do?

This is what I have to do: Write an application that asks the user to input the radius of a circle as a floating-point number and draws the circle, as well as the values of the circle's diameter, circumference and area. Use the value 3.14159 for pi. [Note: You may also use the predefined constant Math.PI for the value of pi. This constant is more precise than the value 3.14159. Class Math is declared in the java.lang package, so you need not import it.] Use the following formulas (r is the radius):
diameter = 2r
circumference = 2PIr
area = PI r^2

The user should also be prompted for a set of coordinates in ddition to the radius. Then draw the circle and display its diameter, circumference, and area, using an Ellipse2D.Double object to represent the circle and mehtod draw of class Graphics2D to display it.

code:

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;

class Circle extends JComponent{
   private double radius;

public Circle(double r)
    {radius = r;}
public void drawCircle(Graphics gr){
    Graphics2D g = (Graphics2D)gr;
    Ellipse2D.Double ellipse = new Ellipse2D.Double(0,0,2.0*radius,2.0*radius);
    g.draw(ellipse);
}
  public static void main(String[] args) {

   double radius=Double.parseDouble(JOptionPane.showInputDialog( "Enter radius of the circle" ));
   double diameter;
   double circumference;
   double area;
   diameter = 2 * radius;
   circumference = 2 * Math.PI * radius;
   area = Math.PI * radius * radius;
   JLabel diameter2 = new JLabel("Diameter: " + diameter);
   JLabel circumference2 = new JLabel("Circumference: " + circumference);
   JLabel area2 = new JLabel("Area: " + area);

JPanel text = new JPanel(new GridLayout(2,2)); ...

I am completely lost right now. I don't get what the questions are trying to say and I want to know if someone can give me pseducode or just a small example on how to start them off because like I said I'm lost. I'm not trying to get answers or someone to do the work for me. I just need a general idea.

  1. (Order of catch Blocks) Write a program that shows that the order of catch blocks is important. If you try to catch a superclass exception type before a subclass type, the compiler should generate errors.

  2. (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an exception handler. Define class SomeClass, which throws an Exception in the constructor. Your program should try to create an object of type SomeClass and catch the exception that's thrown from the constructor.

Oh, now I see, thank you very much :) I will keep in mind that a/b will be = 1 (Java is confusing :P)
By the way, the way you showed me worked and after I saw how you did it, I tried another way which worked:

    public double findVolume(){
        return (double)(4*3.14*r*r*r)/3;

How would I rearrange it? I tried doing double n = 4/3; int n = 4/3; (3.14 rrr) 4/3; And still no luck.

I am havin an issue with the findVolume for the sphere part. It seems to ignore the "4/3" part but calculates everything else. Is there a way I can make it include this function?

Here is the code:

public class Sphere extends threeDShape{
    double r;
    public Sphere(double x, double y, double r){
        super(x, y, r, r, r);
        this.r = r;
    }
    public double findArea(){
        return(double)((4*3.14*r*r));
    }
    public double findVolume(){
        return (double)(4/3*3.14*r*r*r);

    }
    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }

    @Override
    public String toString() {
        return String.format("The area of the sphere is: " + findArea() +
                "\nThe volume of the sphere is: " + findVolume());
    }
}

The quadierlateral is the last part where I put in all the info. The points is what gets and sets the x and y variables. And I am passing doubles for 4 shapes.

I have to create a quadrilateral program for school where you put in two points and find the area. For the Public double getArea() part it says "return type double is not compatible with void" How do I fix it?

Main class

public class Point {
    double x;
    double y;

public Point(double pX, double pY){
//   this.x = x;
//   this.y = y;
    x = pX;
    y = pY;
}
public void setX (double pX){
//    this.x = x;
    x = pX;
}
public void setY (double pY){
//    this.y = y;
    y = pY;
}
public double getX(){
    return x;
}
public double getY(){
    return y;
}
    @Override
public String toString(){
    return String.format("(" + x + "," + y + ")");
}
}

Quadrilateral class

Trapezoid(double ptX,double ptY){
super(ptX,ptY);
}

public double getArea(){
    return (x*y)/2;
}

    @Override
public String toString(){
 return String.format ("Trapezoid coords: " + "(" + x + "," + y + ")",
         "Area: " + getArea());

Alright here is what I did so far. Does it look like I did more work than I need(ed) to? Because I'm not sure.

Main class:

        import java.util.*;
        import java.text.*;

        public class Emergency {
        DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
        Date curDate = new Date();
        Calendar cal = Calendar.getInstance();
        private String fullName;
        private String address;
        private String phoneNumber;
        private String emergencyType;
        private String severityLevel;
        private String responseType;
        private String statusType;

        public Emergency(String fName, String location, String phone, String emergency, String severity, 
                String response, String status){
            fullName = fName;
            address = location;
            phoneNumber = phone;
            emergencyType = emergency;
            severityLevel = severity;
            responseType = response;
            statusType = status;
        }
        Emergency(){

        }
        public void setFullName(String fullName){
            this.fullName = fullName;
         }
        public String getFullName(){
            return fullName;
        }
        public void setAddress(String address){

            }
        public String getAddress(){
            return address;
        }
        public void setPhoneNumber(String phoneNumber){

        }
        public String getPhoneNumber(){
            return phoneNumber;
        }
        public void setEmergencyType(String emergencyType){

        }
        public String getEmergencyType(){
            return emergencyType;
        }
        public void setSeverityLevel(String severityLevel){

        }
        public String getSeverityLevel(){
            return severityLevel;
        }

        public String getResponseType(){
            return "Alright, we have alerted someone about your emergency!";
        }
        public String statusType(){
            return statusType();
        }
        }

Is there a way I can make it so depending on the type of emergency the status type will be different (e.g. inputting injury and the status says an ambulance is on its way or if you input robbery the status says a poilce car is on its way)?

Subclass:

        import java.util.Scanner;

        public class Emergency_Report {
        public static void main(String[] args) { ...

Rubberman, I'll get right on the coding as soon as I get back from work. But I just want to ask, would it be better to make a switch statement and have the user choose the number that corresponds with the nature of the emergency and severity or have them just type it out and press a number (1 not severe to 5 severe) for the severity?

Alright so the variables I have just keep them but make a subclass that calls for them? Also, for the info I would make the user input that? And sorry if I'm asking the same thing or obvious questions. I'm not asking for anyone to do my work :) I just like being able to understand and get a general idea.

This is the program we were assigned to do
(Project: Emergency Response Class) The North American emergency response service, 9-1-1, connects callers to a local Public Service Answering Point (PSAP). Traditionally, the PSAP would ask the caller for identification information—including the caller’s address, phone number and the nature of the emergency, then dispatch the appropriate emergency responders (such as the police, an ambulance or the fire department). Enhanced 9-1-1 (or E9-1-1) uses computers and databases to determine the caller’s physical address, directs the call to the nearest PSAP, and displays the caller’s phone number and address to the call taker. Wireless Enhanced 9-1-1 provides call takers with identification information for wireless calls. Rolled out in two phases, the first phase required carriers to provide the wireless phone number and the location of the cell site or base station transmitting the call. The second phase required carriers to provide the location of the caller (using technologies such as GPS). To learn more about 9-1-1, visit www.fcc.gov/pshs/services/911-services/Welcome.html and people.howstuffworks.com/9-1-1.htm.

An important part of creating a class is determining the class’s attributes (instance variables). For this class design exercise, research 9-1-1 services on the Internet. Then, design a class called Emergency that might be used in an object-oriented 9-1-1 emergency response system. List the attributes that an object of this class might use to represent the emergency. For example, the class might include information on who reported the emergency (including their phone number), the location of the emergency, the time of the report, ...

JamesCherrill I realized that after I posted this XD Thanks for telling me. Also I did not know it was 0-9 in Java. And jwenting I didn't know that cuz I thought that's how you do 'if' 'else' statements.

Forgot to mention, it only chooses the number one for the seat number it doesn't randomize them.

This is what the assignment is: (Airline Reservations System) A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to write an application to assign seats on each flight of the airline's only plane (capacity: 10 seats).
Your application should display the following alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your application should assign a seat in the first-class section (seats 15). If the user types 2, your application should assign a seat in the economy section (seats 610). Your application should then display a boarding pass indicating the person's seat number and whether it is in the first-class or economy section of the plane.
Use a one-dimensional array of primitive type boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding elements of the array to true to indicate that the seat is no longer available.
Your application should never assign a seat that has already been assigned. When the economy section is full, your application should ask the person if it is acceptable to be placed in the first-class section (and vice versa). If yes, make the appropriate seat assignment. If no, display the message "Next flight leaves in 3 hours."
It doesn't seem to work and I ...

I added this but still no luck:

personalInfo.setBirthMonth(month);
       personalInfo.setBirthDay(day);
       personalInfo.setBirthYear(year);

Hi, I need help , the assignment I have to do is for a healthprofile class but I am having issues . It doesn ' t show the month , day , or year in mm / dd / yyyy format it only shows 0 / 0 / 0 . It doesn ' t calculate age it still says 2013 and it doesn ' t show the maximum heart rate or targeted heart rate . Can someone please help ?

Here is the code :

mport java . util .*;
public class HealthProfile {
String firstName ;
String lastName ;
char gender ;
int BirthMonth ;
int BirthDay ;
int BirthYear ;
int height ;
int weight ;
public HealthProfile ( String fName , String lName , char Genderr , int birthMonth , int birthDay , int birthYear , int heightt , int weightt ){
firstName = fName ;
lastName = lName ;
gender = Genderr ;
BirthMonth = birthMonth ;
BirthDay = birthDay ;
BirthYear = birthYear ;
height = heightt ;
weight = weightt ;
}
HealthProfile () {
}
public void setFirstName ( String firstName ) {
this . firstName = firstName ;
}
public String getFirstName () {
return firstName ;
}
public void setLastName ( String lastName ) {
this . lastName = lastName ;
}
public String getLastName () {
return lastName ;
}
public void setGender ( char gender ) {
this . gender = gender ;
}
public char getGender () { ...