1answer.
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
Harrizon [31]
4 years ago
8

Can I have some help debugging this exercise:// Application lists valid shipping codes// then prompts user for a code// Applicat

ion accepts a shipping code// and determines if it is validimport java.util.*;public class DebugEight1{public static void main(String args[]){Scanner input = new Scanner(System.in);char userCode;String entry, message;boolean found = false;char[] okayCodes = {'A''C''T''H'};StringBuffer prompt = newStringBuffer("Enter shipping code for this delivery\nValid codes are: ");for(int x = 0; x < length; ++x){prompt.append(okayCodes[x]);if(x != (okayCodes.length - 1))prompt.append(", "); }System.out.println(prompt);entry = input.next();userCode = entry.charAt(0);for(int i = 0; i < length; ++i){if(userCode = okayCodes){found = true;}}if(found)message = "Good code";elsemessage = "Sorry code not found";System.out.println(message);}}
Computers and Technology
1 answer:
gizmo_the_mogwai [7]4 years ago
3 0

Answer:

See Explanation

Explanation:

The following lines of codes were corrected.

<em>Note only lines with error are listed out</em>

char[] okayCodes = {'A''C''T''H'};

corrected to

char[] okayCodes = {'A','C','T','H'};

StringBuffer prompt = newStringBuffer("Enter shipping code for this delivery\nValid codes are: ");

corrected to

StringBuffer prompt = new StringBuffer("Enter shipping code for this deliveryValid codes are: ");

for(int x = 0; x < length; ++x)

corrected to

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

for(int i = 0; i < length; ++i)

corrected to

for(int i = 0; i < okayCodes.length; ++i)

if(userCode = okayCodes)

corrected to

if(userCode == okayCodes[i])

if(found)message = "Good code";elsemessage = "Sorry code not found";

corrected to

if(found)

message = "Good code";

else

message = "Sorry code not found";

<em>However, I've added the full source code as an attachment</em>

Download java
You might be interested in
*explain why computer literacy is vital to access in today’s business work
kkurt [141]

Answer:

Computer literacy is vital to access in today’s business work because of advanced technology which ensured that most companies run a computerized system as against the manual one which was existent in the past.

The use of computerized system enables work to be done faster and in a more accurate manner which is why bring a computer literate is widely embraced in the world today.

8 0
3 years ago
To nest one structure within another structure, you a. define both structures and then create a data member of the nested struct
Lubov Fominskaja [6]

Answer:

Hence the correct option is option a) define both structures and then create a data member of the nested structure type within the other structure.

Explanation:

To make Address nested to Employee, we've to define Address structure before and out of doors Employee structure and make an object of Address structure inside Employee structure.

For example, we may need to store the address of an entity employee in a structure.

5 0
3 years ago
Item = "quesadilla"
jok3333 [9.3K]

Answer:

item = "quesadilla"

meat = "steak"

queso = False

guacamole = False

double_meat = False

base_price = 4.5

if item == "quesadilla":

base_price = 4.0

elif item == "burrito":

base_price = 5.0

if meat == "steak" or meat == "pork":

base_price += 0.50

if meat == "steak" and double_meat:

base_price += 1.50

elif meat == "pork" and double_meat:

base_price += 1.50

elif double_meat:

base_price += 1.0

if guacamole:

base_price += 1.0

if queso and item != "nachos":

base_price += 1.0

print(base_price)

Explanation:

  • Use a conditional statement to check if meat is steak or pork then add 0.50 to base_price .
  • Check if the meat is steak or pork, then double_meat adds 1.50 or 1.0 otherwise .
  • Check if meat is steak and its double_meat , then add 1.50  and if its for guacamole, then add 1.00 to base_price . If queso is there and item is not nachos, add 1.00 to base_price .
  • Finally when item is nachos, no need to add any money to base_price .

7 0
3 years ago
Jake's been trying to build brand awareness for his new clothing line. Initial branding attempts wer successful, but he now want
Xelga [282]

Answer:

There are over 3 million apps and website available on the Google network.

Explanation:

  • Connect your business
  • Create a beautiful image
  • Set the right goals

Smart display campaigns automatically created 25,000 versions of ad and showed in 55 countries.

Smart display Campaigns help to scale our marketing efficiently.

8 0
3 years ago
Add a script element into your HTML page that prints ‘hello’ to the browser’s JavaScript developer console.
horrorfan [7]

Answer:

<!DOCTYPE html>

<html>

<body>

<h2>My Webpage</h2>

<script>

console.log("hello");

</script>

</body>

</html>  

Explanation:

The above written is the HTML code which contains a script tag in which javascript code is written to print hello on the javascript developer console.The script element contains the statement console.log("hello"); which is used to print the argument provided in the console.log on the console of the  javascript.

To see hello on the console you have open javascript console in the browser.Otherwise it will not be visible to you.

8 0
3 years ago
Other questions:
  • Machine language is made up of which following codes
    11·1 answer
  • He ____________ may include a high-level WBS in a graphic chart format or as an indentured list of the work elements and associa
    14·1 answer
  • The mean of a collection of data is located at the​ ______ of a distribution of data.
    12·1 answer
  • What format must a document be saved in to share it between two different word processors
    11·1 answer
  • If you owned an online clothing company and you only had the resources to run one social media campaign, which platform would yo
    14·1 answer
  • What are the modes of operation of WLANs?
    5·1 answer
  • Ive tried everything how can i get my images back ?
    13·2 answers
  • Which examples are relevant sources for students to use in research?
    6·1 answer
  • How has the dependence on technology made humanity less intelligent?​
    15·1 answer
  • Software piracy can be described as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!