answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Blababa [14]
1 year ago
11

Create a program named Auction that allows a user to enter an amount bid on an online auction item. Include three overloaded met

hods that accept an int, double, or string bid. Each method should display the bid and indicate whether it is over the minimum acceptable bid of $10. If the bid is greater than or equal to $10, display Bid accepted. If the bid is less than $10, display Bid not high enough. If the bid is a string, accept it only if one of the following is true: It is numeric and preceded with a dollar sign. It is numeric and followed by the word dollars. Otherwise, display a message that says Bid was not in correct format. Grading When you have completed your program, click the Submit button to record your score.
Computers and Technology
1 answer:
Olin [163]1 year ago
3 0

Answer:

Explanation:

The following code is written in Java and creates the overloaded methods as requested. It has been tested and is working without bugs. The test cases are shown in the first red square within the main method and the output results are shown in the bottom red square...

class Auction {

   public static void main(String[] args) {

       bid(10);

       bid(10.00);

       bid("10 dollars");

       bid("$10");

       bid("150 bills");

   }

   public static void bid(int bid) {

       if(bid >= 10) {

           System.out.println("Bid Accepted");

       } else {

           System.out.println("Bid not high enough");

       }

   }

   public static void bid(double bid) {

       if(bid >= 10) {

           System.out.println("Bid Accepted");

       } else {

           System.out.println("Bid not high enough");

       }

   }

   public static void bid(String bid) {

       if (bid.charAt(0) == '$') {

           if (Integer.parseInt(bid.substring(1, bid.length())) > 0) {

               System.out.println("Bid Accepted");

               return;

           } else {

               System.out.println("Bid not in correct Format");

               return;

           }

       }

       int dollarStartingPoint = 0;

       for (int x = 0; x < bid.length(); x++) {

           if (bid.charAt(x) == 'd') {

               if (bid.substring(x, x + 7).equals("dollars")) {

                   dollarStartingPoint = x;

               } else {

                   break;

               }

           }

       }

       if (dollarStartingPoint > 1) {

           if (Integer.parseInt(bid.substring(0, dollarStartingPoint-1)) > 0) {

               System.out.println("Bid Accepted");

               return;

           } else {

               System.out.println("Bid not in correct format");

               return;

           }

       } else {

           System.out.println("Bid not in correct format");

           return;

       }

   }

}

You might be interested in
add is a method that accepts two int arguments and returns their sum. Two int variables, euroSales and asiaSales, have already b
Oduvanchick [21]

Answer:

// here is code in Java.

// package

import java.util.*;

// class definition

class Main

{

   // method that return sum of two sale value

   public static int Add(int euroSales,int asiaSales)

   {

       // return the sum

       return euroSales+asiaSales;

   }

   //main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // variables

       int euroSales=100;

       int asiaSales=150;

       int eurasiaSales;

        // call the function

       eurasiaSales=Add(euroSales,asiaSales);

        // print the sum

       System.out.println("total sale is:"+eurasiaSales);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize two variables "euroSales=100" and "asiaSales=150". Declare another variable eurasiaSales. Call the method Add() with euroSales and asiaSales as parameter. This method will add both the value and return the sum.This sum will be assigned to variable eurasiaSales.Then print the sum.

Output:

total sale is:250  

8 0
2 years ago
A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
11Alexandr11 [23.1K]

Answer:

Attenuation = 0.458\ db

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Where P_s = Power\ Input and P_d  = Power\ output

P_s = 100W

P_d = 90W

Substitute these values in the given formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Attenuation = 10Log_{10}\frac{100}{90}

Attenuation = 10 * 0.04575749056

Attenuation = 0.4575749056

Attenuation = 0.458\ db <em>(Approximated)</em>

7 0
2 years ago
Every employee of your company has a Google account. Your operational team needs to manage a large number of instances on Comput
Blizzard [7]

Answer:

Generate the fresh set of SSH keys. Offer every member of the team that private key. Customize the public key as a public SSH key for a project in the Cloud Platform project as well as require public SSH keys for each instance

Explanation:

Almost many person seems to have a google profile at their corporation. The vast amount of incidents on Compute Machine have to be handled by the operating staff. Any team member just requires operational accessibility towards the network. The safety department needs to ensure that credentials are distributed in such an administratively efficient way and have to be prepared to recognize that has accessed the specified case.

So, they are creating the latest key set for SSH. Offer every members of the team their private key. Customize its public key as just a public SSH key for such a program in the Cloud Platform project as well as require public SSH keys for each instance.

7 0
2 years ago
An online article in 2001 described a study in which twelve sixth-grade students who had not previously played chess participate
ipn [44]
Bdbxhdhdhdbxbdhdhxhxhdhdhdhdhdhdhdhdhdbdhdhdhdhdhdhrhrhrhrhrhdhdhdhdisisieiejjdidieieieieieiei
6 0
2 years ago
An IT department submits a purchase order to buy a new computer from a vendor. "Purchase orders" are documents issued by buyers
Umnica [9.8K]

Answer:

Procurement

Explanation:

Characteristics hardware lifecycle:

  • Procurement- Acquiring new IT hardware assets involves evaluating vendors, purchase orders, receiving, and device labeling.
  • Deployment - Hardware configuration and installment, placing hardware and software assets into production environments.
  • Maintenance & Support - Management of assets include scheduling scans and getting audit history.
  • Upgrade - Before you retire your IT hardware assets, you’ll reach a processing plateau that can be restored with hardware upgrades.
3 0
2 years ago
Other questions:
  • A BCD code is being transmitted to a remote receiver. The bits are A3, A2, A1, and A0, with A3as the MSB. The receiver circuitry
    8·1 answer
  • PLEASE HELP!! WILL GIVE BRAINLIEST!!
    15·2 answers
  • The most direct way for Jonathan to gain on-the-job experience and earn money while attending school is to apply for:
    5·2 answers
  • The attack in which the attacker sends a forged packet with the same source IP address and destination IP address in which the v
    10·1 answer
  • Which one of the following is a correct declaration for a method named passAList that has as arguments an array list myList of s
    8·1 answer
  • There is a file "IT4983" in my home (personal) directory. I don’t know my current working directory. How can I find out the file
    11·1 answer
  • Question 1 :Which type of unshielded twisted pair (UTP) cable is commonly used for 1000BASE-T Ethernet networks and is often mad
    8·1 answer
  • For any element in keysList with a value greater than 60, print the corresponding value in itemsList, followed by a semicolon (n
    14·2 answers
  • Write a method named removeDuplicates that accepts a string parameter and returns a new string with all consecutive occurrences
    7·1 answer
  • Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!