SlideShare uma empresa Scribd logo
1 de 3
Baixar para ler offline
HELPIDO.COM

CLICK HERE TO GET THE SOLUTION !!!!!!!


PRG/420 Java Programming I - Week 3

Week Three: Conditional and Iterative Structures



Discussion Question : Loops



Our focus this week is loops.

Select and complete one of the following activities:

Convert the following program from for loop to while loop.



class ArithmeticProgression

{

public static void main (String [] args)

{

    int sum = 0;



        for (int i = 1; i <= 1000; i++)

        {

            sum = sum + i;

            System.out.println(Integer.toString(sum));

    }

}

}



Compare the efficiency between a for loop and a while loop in the same program. Your program
should be able to tell if a for loop is faster than a while-loop at the end of the program. Include the
result of your run with the information on which one is faster.
Discussion Question : Three Kinds of Loops

There are 3 kinds of loops—for loop, while loop, and do while loop. Under which circumstances
would each kind of loop be more appropriate? Explain your answers using specific examples.



Individual Simple Commission Calculation Program Part 2



Modify the Week Two Java™ application using Java™ NetBeans™ IDE to meet these additional and
changed business requirements:

•         The company has recently changed its total annual compensation policy to improve sales.

•         A salesperson will continue to earn a fixed salary of $50,000. The current sales target for
every salesperson is $120,000.

•        The sales incentive will only start when 80% of the sales target is met. The current
commission is 5% of total sales.

•          If a salesperson exceeds the sales target, the commission will increase based on an
acceleration factor. The acceleration factor is 1.5.

•        The application should ask the user to enter annual sales, and it should display the total
annual compensation.

•         The application should also display a table of potential total annual compensation that the
salesperson could have earned, in $5000 increments above the salesperson’s annual sales, until it
reaches 50% above the salesperson’s annual sales.



Sample Table: Assuming a total annual sales of $100,000, the table would look like this:



Total Sales      Total Compensation

100,000 <<Program calculated value>>

105,000 <<Program calculated value>>

110,000 <<Program calculated value>>

115,000 <<Program calculated value>>

120,000 <<Program calculated value>>

125,000 <<Program calculated value>>

130,000 <<Program calculated value>>
135,000 <<Program calculated value>>

140,000 <<Program calculated value>>

145,000 <<Program calculated value>>

150,000 <<Program calculated value>>



The Java™ application should also meet these technical requirements:



•        The application should have at least one class, in addition to the application’s controlling
class.

•        The source code must demonstrate the use of conditional and looping structures.

•        There should be proper documentation in the source code.


CLICK HERE TO GET THE SOLUTION !!!!!!!

Mais conteúdo relacionado

Último

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Último (20)

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

Prg 420 week 3

  • 1. HELPIDO.COM CLICK HERE TO GET THE SOLUTION !!!!!!! PRG/420 Java Programming I - Week 3 Week Three: Conditional and Iterative Structures Discussion Question : Loops Our focus this week is loops. Select and complete one of the following activities: Convert the following program from for loop to while loop. class ArithmeticProgression { public static void main (String [] args) { int sum = 0; for (int i = 1; i <= 1000; i++) { sum = sum + i; System.out.println(Integer.toString(sum)); } } } Compare the efficiency between a for loop and a while loop in the same program. Your program should be able to tell if a for loop is faster than a while-loop at the end of the program. Include the result of your run with the information on which one is faster.
  • 2. Discussion Question : Three Kinds of Loops There are 3 kinds of loops—for loop, while loop, and do while loop. Under which circumstances would each kind of loop be more appropriate? Explain your answers using specific examples. Individual Simple Commission Calculation Program Part 2 Modify the Week Two Java™ application using Java™ NetBeans™ IDE to meet these additional and changed business requirements: • The company has recently changed its total annual compensation policy to improve sales. • A salesperson will continue to earn a fixed salary of $50,000. The current sales target for every salesperson is $120,000. • The sales incentive will only start when 80% of the sales target is met. The current commission is 5% of total sales. • If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.5. • The application should ask the user to enter annual sales, and it should display the total annual compensation. • The application should also display a table of potential total annual compensation that the salesperson could have earned, in $5000 increments above the salesperson’s annual sales, until it reaches 50% above the salesperson’s annual sales. Sample Table: Assuming a total annual sales of $100,000, the table would look like this: Total Sales Total Compensation 100,000 <<Program calculated value>> 105,000 <<Program calculated value>> 110,000 <<Program calculated value>> 115,000 <<Program calculated value>> 120,000 <<Program calculated value>> 125,000 <<Program calculated value>> 130,000 <<Program calculated value>>
  • 3. 135,000 <<Program calculated value>> 140,000 <<Program calculated value>> 145,000 <<Program calculated value>> 150,000 <<Program calculated value>> The Java™ application should also meet these technical requirements: • The application should have at least one class, in addition to the application’s controlling class. • The source code must demonstrate the use of conditional and looping structures. • There should be proper documentation in the source code. CLICK HERE TO GET THE SOLUTION !!!!!!!