Jump to content

4 posts in this topic

Recommended Posts

Posted

 

//This program allows the user to search through files from the Social //Security Administraction which contain data on various names. //If found, it then graphs the popularity of each name over time. //Constant values can be used to alter the program's starting year //and the display of the graph itself. import java.util.*; import java.awt.*; import java.io.*; public class BabyNames { public static final int STARTING_DECADE = 1890; //will be initial decade public static final int WIDTH = 60; //width of decade bars on graph public static final int HEIGHT = 30; //height of grey rectangles on graph //This method assigns the return of an indtroductory method to a String and //then passes that string into another method. public static void main(String[] args) throws FileNotFoundException { String name = introName(); conditional(name); } //prints a description of the program, then invites the user to input a name. //Returns the inputted name to main. public static String introName() { System.out.println("This program allows you to search through the"); System.out.println("data from the Social Security Administration"); System.out.println("to see how popular a particular name has been"); System.out.println("since " + STARTING_DECADE + "."); System.out.println(); System.out.print("Name: "); Scanner console = new Scanner(System.in); String name = (console.next()); return name; } //This method evaluates whether or not the inputted name is valid by passing it into //a search method to scan the text files. If the name is valid, this method will call the //graphics methods to construct the graph. If not valid, the method will give a "not found" //reply. The parameter passed is the inputted name. public static void conditional(String name) throws FileNotFoundException { Scanner names = new Scanner(new File("names.txt")); String stats = search(names, name); if (stats.length() > 0) { Scanner meanings = new Scanner(new File("meanings.txt")); String meaning = search(meanings, name); if (meaning.length() > 0) { DrawingPanel graph = new DrawingPanel(780, 560); Graphics g = graph.getGraphics(); graphTemplate(g); graphMeaning(g, meaning); graphDates(g, stats); } } else { System.out.print("\"" + name + "\"" + " not found."); } } //used as a method to search text files for the inputted name. Accepts a Scanner assigned //to a certain .text document, and the user inputted name. public static String search(Scanner namesList, String name) throws FileNotFoundException { while(namesList.hasNextLine()) { String nameLC = name.toLowerCase(); String line = namesList.nextLine(); String lineLC = line.toLowerCase(); if(lineLC.indexOf(nameLC) == 0 && lineLC.charAt(nameLC.length()) == ' ') { System.out.println(line); return line; } } return ""; } //prints the fixed background graphics for the graph. Accepts graphics as parameter. public static void graphTemplate(Graphics g) { g.setColor(Color.LIGHT_GRAY); g.fillRect(0, 0, 780, 0 + HEIGHT); g.fillRect(0, 560 - HEIGHT, 780, 560); g.setColor(Color.BLACK); g.drawLine(0, HEIGHT, 780, HEIGHT); g.drawLine(0, 560 - HEIGHT, 780, 560 - HEIGHT); g.drawRect(0, 0, 779, 559); } //prints the meaning of the name at the header of the graph (top grey rectangle). Accepts //graphics and the string for the meaning of the name as parameters public static void graphMeaning(Graphics g, String meaning) throws FileNotFoundException { g.setColor(Color.BLACK); g.drawString(" " + meaning, 0, 16); } //prints the dates on the graph, their corresponding population values, //and fills in the bars on the graph, the color corresponding to each gender. //Accepts graphics and the string of dates as parameters. public static void graphDates(Graphics g, String stats) throws FileNotFoundException { String gender = stats.substring((stats.indexOf(" ") + 1), (stats.indexOf(" ") + 3)); String dates = stats.substring(stats.indexOf(" ") + 3); Scanner dates2 = new Scanner(dates); int yearCount = 0; while(dates2.hasNextInt()) { int n = dates2.nextInt(); g.setColor(Color.BLACK); g.drawString(" " + (STARTING_DECADE + yearCount * 10), yearCount * WIDTH, 552); if (n == 0) { g.drawString(" " + 0, yearCount * WIDTH, 560 - HEIGHT); } else { g.drawString(" " + n, yearCount * WIDTH, ((n % 2) + (n / 2) + HEIGHT)); g.setColor(Color.PINK); if (gender.charAt(0) == 'm'){ g.setColor(Color.BLUE); } g.fillRect(yearCount * WIDTH, ((n % 2) + (n / 2) + HEIGHT), WIDTH / 2, 560 - ((n % 2) + (n / 2) + HEIGHT) - HEIGHT); } yearCount++; } } }

 

Posted (edited)

what does it do?

It says what it does in the code:

//This program allows the user to search through files from the Social //Security Administraction which contain data on various names. //If found, it then graphs the popularity of each name over time. //Constant values can be used to alter the program's starting year //and the display of the graph itself. 
Updated by Goggwell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Universe Invader 2: Alien War v1.0.8 [ +12 Cheats ] Currency Max
      Modded/Hacked App: Universe Invader 2: Alien War By GCENTER VIET NAM TECHNOLOGY JOINT STOCK COMPANY
      Bundle ID: com.GCenter.com.universe.invaders.alien.war.attack.V2
      App Store Link: https://apps.apple.com/us/app/universe-invader-2-alien-war/id6739988487?uo=4

       
      🤩 Hack Features

      - Auto Win

      - ViP Point

      - Gems

      - Coins

      - Energy

      - Booster

      - Keys +2

      - Life

      - DMG

      - Zone Unlock [ No Need Star ]

      - Ship & Dron Unlock Cost 0
        • Like
      • 0 replies
    • Universe Invader 2: Alien War v1.0.8 [ +12 Jailed ] Currency Max
      Modded/Hacked App: Universe Invader 2: Alien War By GCENTER VIET NAM TECHNOLOGY JOINT STOCK COMPANY
      Bundle ID: com.GCenter.com.universe.invaders.alien.war.attack.V2
      App Store Link: https://apps.apple.com/us/app/universe-invader-2-alien-war/id6739988487?uo=4


      🤩 Hack Features

      - Auto Win

      - ViP Point

      - Gems

      - Coins

      - Energy

      - Booster

      - Keys +2

      - Life

      - DMG

      - Zone Unlock [ No Need Star ]

      - Ship & Dron Unlock Cost 0
        • Like
      • 0 replies
    • Solo Leveling:Arise v1.2.77 Jailed Cheats +2
      Modded/Hacked App: Solo Leveling:Arise By Netmarble Corporation
      Bundle ID: com.netmarble.sololv
      iTunes Store Link: https://apps.apple.com/us/app/solo-leveling-arise/id1662742277?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Immunte to Physical Damage
      - Multiply Attack



      iOS Hack Download IPA Link: https://iosgods.com/topic/184739-solo-levelingarise-v1265-jailed-cheats-2/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 395 replies
    • Agar.io v2.30.2 Jailed Cheats +1
      Modded/Hacked App: Agar.io by Miniclip SA
      Bundle ID: com.miniclip.agar.io
      iTunes Store Link: https://itunes.apple.com/us/app/agar-io/id995999703?mt=8&uo=4&at=1010lce4



      Hack Features:
      - Normal Mode Zoom Hack - Tested with value 0.08 - More Zoom = More Small Value
      - BR Mode Zoom Hack - Tested with value 0.08 - More Zoom = More Small Value


      Hack Download Link: https://iosgods.com/topic/82572-arm64-agario-v230-jailed-cheats-1/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,262 replies
    • [ Arknights China ] 明日方舟 Cheats v2.6.01 +8
      Modded/Hacked App: 明日方舟 By Shanghai Hypergryph Network Technology Co., Ltd.
      Bundle ID: com.hypergryph.arknights
      iTunes Store Link: https://apps.apple.com/cn/app/%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F/id1454663939?uo=4


      Hack Features:
      - God Mode
      - Frozen Enemies
      - One Hit Kill
      - Instant - Win
      - No Deploy Cost
      - Multiply Damage
      - Multiply Defense
      - Multiply Character Speed


      iOS Hack Download Link: https://iosgods.com/topic/149509-arknights-china-%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F-cheats-v1560-8/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 310 replies
    • PewDiePie's Tuber Simulator Cheats v2.55.0 +3
      Modded/Hacked App: PewDiePie's Tuber Simulator By Outerminds Inc.
      Bundle ID: com.outerminds.tubular
      iTunes Store Link: https://apps.apple.com/us/app/pewdiepies-tuber-simulator/id1093190533?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Infinite Subscriber
      - Infinite Views
      - Infinite Bux

      NOTE: Please complete tutorial first before enabling the hacks otherwise it won't work

      NOTe 2: Please make a youtube video to get some views first (without hack) then before enable infinite views

       

      Non-Jailbroken Hack: https://iosgods.com/topic/86411-pewdiepies-tuber-simulator-v2450-jailed-cheats-3/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/86366-pewdiepies-tuber-simulator-cheats-v2460-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,155 replies
    • Battle Legion - Mass Battler Cheats v4.3.8 +4
      Modded/Hacked App: Battle Legion - Mass Battler By GODSPEED GAMING SOLUTIONS PRIVATE LIMITED
      Bundle ID: com.traplight.battleslides
      iTunes Store Link: https://apps.apple.com/us/app/battle-legion-mass-battler/id1435133042?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Multiply Attack
      - Multiply Defense
      - Instant Win
      - Enemies Don't Move
      - Enemies Don't Attack

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/129669-battle-legion-mass-battler-cheats-v424-4/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 575 replies
    • Honkai Impact 3 (SEA) Cheats v8.3.0 +2 [ Multiply Attack & Defense ]
      Modded/Hacked App: Honkai Impact 3 By COGNOSPHERE PTE. LTD.
      Bundle ID: com.miHoYo.bh3oversea
      iTunes Store Link: https://apps.apple.com/ph/app/honkai-impact-3/id1299582178?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Multiply Attack
      - Multiply Defense

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/134285-honkai-impact-3-sea-cheats-v810-2-multiply-attack-defense/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 496 replies
    • SnapEdit - Remove Objects AI Modded v5.9.4 +1
      Modded/Hacked App: SnapEdit - Remove Objects AI By SilverAI Joint Stock Company
      Bundle ID: com.sfun.snapedit
      App Store Link: https://apps.apple.com/us/app/snapedit-remove-objects-ai/id1611282499?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - PREMIUM

       

      Free Non-Jailbroken Hack: https://iosgods.com/topic/197205-snapedit-remove-objects-ai-v594-jailed-mod-1/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/175364-snapedit-remove-objects-ai-modded-v594-1/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 97 replies
    • Subnautica v1.21.82617 +100++ Jailed Cheats [ Developer Menu ]
      Modded/Hacked App: Subnautica By Unknown Worlds Entertainment, Inc.
      Bundle ID: com.UnknownWorlds.Subnautica
      App Store Link: https://apps.apple.com/us/app/subnautica/id6478639011?uo=4

       
       

      🤩 Hack Features

      - Developer Menu -> Pause the game and you will see a Developer Menu button.

      For all developer commands, go here.
        • Thanks
        • Like
      • 5 replies
    • Subnautica v1.21.82617 +100++ Cheats [ Developer Menu ]
      Modded/Hacked App: Subnautica By Unknown Worlds Entertainment, Inc.
      Bundle ID: com.UnknownWorlds.Subnautica
      App Store Link: https://apps.apple.com/us/app/subnautica/id6478639011?uo=4

       


      🤩 Hack Features

      - Developer Menu -> Pause the game and you will see a Developer Menu button.

      For all developer commands, go here..
        • Winner
        • Like
      • 4 replies
    • Dawn of Ages: Medieval Games v2.0.8 +5 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Dawn of Ages: total war battle By BoomBit, Inc.
      Bundle ID: com.stratospheregames.dawnofages
      App Store Link: https://apps.apple.com/us/app/dawn-of-ages-total-war-battle/id6477473268?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Dumb Enemy
      - Premium Enabled
        • Agree
        • Winner
        • Like
      • 12 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines